npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

soc-bff-runtime

v0.0.5

Published

### 服务部署

Downloads

2

Readme

soc-bff-runtime

服务部署

  1. 配置文件地址:/conf/config.json

使用

启动服务

    yarn start  或者 npm run start 或者 node <projectDir>/dist/src/index.js

安装依赖

    yarn install 或者 npm install

构建服务

    yarn build 或者 npm run build

配置文件

生产环境:dist/conf/config.json

生产服务地址配置: dist/conf/config.json 文件中属性 production

生产配置说明

{
  production: { // 生产环境配置
      "port": 3003, // http服务端口
      "https": false,// 是否启动https服务(目前https与http服务不同时启动,有需求可以调整)
      "apiPrefix": "https://127.0.0.1:443/soc"// 后端服务地址(soc项目 包括 soc)
  }
}

https 需要证书密匙 文件 放入 dist/conf下面 命名为 ssl-key.pem 私匙, ssl.pem 证书

启动检查

open页面 http://localhost:3003/graphql/warn

query {
  search {
    code
    message
  }
}

graphql 服务启动

  1. package.json 文件下的 scripts 下添加 "graphql": "graphql -p 3004 -d dist/src/schema/index.js" 命令

  2. 将参数自定义修改,具体参数修改规则请看 npx graphql --help

  • 注:目前只支持指定的schema地址文件为es5,对于ts和es6及其以上语法暂不支持

启动 graphql 平台步骤

  1. 安装graphql子模块,例如typedgraphql-demo1

      yarn add typedgraphql-demo1
  2. package.json的属性graphql中增加模块名称

      {
        "graphql": [
          "typedgraphql-demo1"
        ]
      }
  3. 步骤二也可以使用主动引入代码调用,在 src/schema/index.ts文件中找到ResolverType变量在数组中增加引用

      import TyepGraphqlDemo1 from 'typedgraphql-demo1';
      ...
      ...
      resolvers: ResolverType = [DemoResolver, TyepGraphqlDemo1] as ResolverType
    
  4. 通过 rollup打包并启动打包文件

     yarn build:rollup && yarn start:bundle

websocket

  • 支持 websocket 链接, 端口默认 4000 可以使用 WS_POR T环境变量修改监听端口号

客户端链接:

 // 链接websocket服务 
 var client = new WebSocket('ws://localhost:4000/') 

 // 添加分组全局分组, 接收分组消息, 可订阅消息
 client.send(JSON.stringify({ type: 'addGroups', data: 'global' }))

  // 添加分组模块分组, 接收分组消息, 可订阅消息
 client.send(JSON.stringify({ type: 'addGroups', data: 'moudle' }))

  // 添加分组模块分组, 接收分组消息, 可订阅消息
 client.send(JSON.stringify({ type: 'addGroups', data: 'custom' }))

   // 添加分组模块分组, 接收分组消息, 可订阅消息, 带参数
 client.send(JSON.stringify({ type: 'addGroups', data: { key: 'moudle', params: { page: 1, pageSize: 10 } } }))


  // 订阅轮训消息
 client.send(JSON.stringify({ type: 'subscription', data: null }))

 // 移除分组,不再接收分组消息
 client.send(JSON.stringify({ type: 'removeGroups', data: 'moudle' }))

 // 通知分组的成员消息,所有监听 `userModule`  的分组链接都会接收到 `{ type: 'addUser' }` 消息
 client.send(JSON.stringify({ type: 'notificationMessage', :data: { type: 'addUser', group: 'userModule' } }))

客户端接收 message 消息,返回数据结构为

[
  {
    "key": "groupName",
    "data": "当前组获取数据"
  }
]