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 🙏

© 2025 – Pkg Stats / Ryan Hefner

koaaaa

v1.0.10

Published

一个随便封装的多进程 koa 框架

Readme

Koaaaa

一个随便封装的多进程 koa 框架

1.项目结构

.
├── config
│   ├── default.js
│   ├── pron.js
│   └── dev.js
├── middleware
│   └── ttt.js
├── tools
│   └── redis.js
├── controller
│   └── testController.js
├── service
│   └── test.js
├── app.js
└── package.json

一下目录均不支持嵌套级别

  • config 配置目录「必需」,会自动读取改目录下的所有文件,配置文件以环境名命名例如:pron,dev,test, default 为默认配置,会与其他配置合并

  • middleware「非必需」 中间件目录,目前暂时不支持中间件顺序设定,中间件暴露为标准的 koa 中间件 async (ctx, next) => Promise 模式

  • tools「非必需」 工具目录,以 (app) => void 方式暴露挂载函数,函数内自己手动往某个地方挂载工具,有 app.tools 对象通常可以挂载到这上面

  • controller 控制器目录「必需」,舍弃了 router 配置,每个控制器代码会传入 app, router, tools 对象 例:

module.exports = (app, router, tools) => {
  router.get('/test', async (ctx) => {
    try {
      ctx.success({ id: app.tools.generateId() })
    } catch (err) {
      console.error(err)
      ctx.error(err)
    }
  })
}
  • service 服务目录「非必需」,自动加载并实例化服务对象,会在构造的时候传入 app 对象,对象会注入到 app.service 对象里面,会忽略 Service 后缀,例如下面例子的 TestService 可以使用 app.service.test 的方式调用

例:

module.exports = class TestService {
  constructor(app) {
    this.app = app
    this.tools = app.tools
  }
}

API

type app: Koa && {
  config: object,
  tools: {
    generateId: () => bigint
  },
  logger: {debug, info, error}// winston
  service: object,
}