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

product.baichanghui.api

v0.1.0

Published

``` yarn ```

Downloads

5

Readme

安装

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')
    • ...