@pkb/node-box

1.5.4 • Public • Published

node-box

基于 koa 封装轻量级的 node 应用,开箱即用

安装

npm i @pkb/node-box -g # 全局安装/本地安装

node-box build # 构建项目
node-box watch # 开发模式

目录

-- app 
  -- controller
  -- router
-- public # 静态资源

controller 示例

controller/home.js

'use strict';

class HomeController {
  async one({ ctx, next }) {

    ctx.body = {
      content: 'one',
    };
  }

  async two({ ctx, next }) {

    ctx.body = {
      content: 'two',
    };
  }
}

module.exports = HomeController;

router 示例

router/home.js

'use strict';

module.exports = app => {
  const { router, controller } = app;

  router.get('/one', controller.home.one);
  router.get('/two', controller.home.two);
  router.get('/');
};

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.5.41latest

Version History

VersionDownloads (Last 7 Days)Published
1.5.41
1.5.30
1.5.20
1.5.10
1.5.00
1.4.580
1.4.570
1.4.540
1.4.500
1.4.480
1.4.470
1.4.440
1.4.390
1.4.380

Package Sidebar

Install

npm i @pkb/node-box

Weekly Downloads

1

Version

1.5.4

License

none

Unpacked Size

8.63 kB

Total Files

17

Last publish

Collaborators

  • xuege2019
  • liuys
  • happyweb