Skip to content

koa-grace 通过目录名自动生成路由的KOA中间件

Notifications You must be signed in to change notification settings

koa-grace/koa-grace-router

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

koa-grace-router

Build Status

File/Folder as path, another router middleware for koa.

Install

$ npm install koa-grace-router --save

Usage

router(app, options)
  • app: {Object} koa instance.
  • options: {Object|String->root}
    • root: {String} router directory

Example

File tree

├── app.js
└── controller
    ├── deal
    │   ├── index.js
    │   └── refund.js
    ├── index.js
    └── test.js

app.js

var koa = require('koa');
var router = require('koa-grace-router');

app.use(router(app, {
  root: './example/controller'
}));

app.listen(3000);

Test

npm test

License

MIT

About

koa-grace 通过目录名自动生成路由的KOA中间件

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published