🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

product.baichanghui.api

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

product.baichanghui.api

``` yarn ```

latest
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

安装

yarn

开发启动

编译

在线启动,重载和停止以及杀死

pm2 start process/test.config.js
pm2 start process/prod.config.js

pm2 reload all
pm2 stop all
pm2 delete all

环境变量

  • process.env.API_ENV
    • dev
    • alpha
    • prod
  • process.env.API_PORT

使用技术

  • koa2
  • elasticsearch
  • sequelize(mysql)
  • sequelize-auto
  • ?mongoose(mongodb)
  • redis
  • hashids
  • graphql
  • ?jest
  • eslint
  • babel7
  • es7
  • rollup
  • pm2
  • http2
  • ?socket

问题

  • koa
    • 跨域问题:koa2-cors
  • [OK]连接 mongo & mysql
  • sequelize
    • [OK]联表查询
    • 写法问题
    • 时间戳类型转化
      • get() { return this.getDataValue('createTimestamp').getTime(); }
      • timezone: '+08:00'
    • 简化数据表定义,带来性能问题
  • mongoose
    • 时间戳类型
  • 连接 redis 缓存
    • koa-redis
  • elasticsearch
    • [OK]连接
  • log
    • koa-logger
    • log4j
    • access log
    • db log
    • err log
  • [OK]ID 加密算法:hashids
  • Mock data 是基于数据库还是 Controller 还是 GraphQL
    • https://www.apollographql.com/docs/graphql-tools/mocking.html
    • koa-mock
    • https://github.com/nuysoft/Mock
  • GraphQL 插件:
    • apollo-server-koa ?
    • koa-graphql
  • 数据结构定义
    • data
    • 200
    • error
      • HTTP Status Code
      • type: 'error' | 'warn'
      • code: 500 | 404
      • message:
      • info:
  • 自动生成 Models 和 Schemas
    • [OK]sequelize-auto
    • 按照 ES6+ 标准生成 Model
    • Table 别名
    • Date 类型数据显示时间戳
  • 编译
    • ES7/babel7:暂不需要语法转换
    • 是否要编译:需要做简单的编译
    • 用什么编译:rollup
    • 编译成什么:合并代码(排除 node_modules 的)、混淆代码
    • 热启动? nodemon
  • 单元测试
    • jest
  • 代码规范
    • eslint babel-eslint
    • pre-commit
  • Node.js 性能平台 *
  • 压力测试
    • sequelize.addHook('beforeDefine')
    • ...

FAQs

Package last updated on 14 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts