impress-router-table
v1.5.0
Published
Sails.js like routing for koa.js
Downloads
6
Maintainers
Readme
impress-router-table
Sails.js like routing for koa.js
Install
$ npm i impress-router-table --save
API
const routing = require('impress-router-table');
routing(rootdir, router)
returns a koa middleware
const app = new (require('koa'))
app.use(routing(__dirname + '/api'))
app.listen(9000)
router
router must support get
/ post
/ etc HTTP methods
defaults to an new impress-router instance
Folder structure in rootdir
for example in previous example, __dirname + '/api'
,
take a look at test/demo/api/
test/demo/api
├── controllers
│ ├── PolicyTestController.js
│ └── RouteTestController.js
├── policies
│ ├── auth.js
│ └── bar.js
├── policy.js # policy config
└── routes.js # routes config
2 directories, 6 files
Changelog
License
the MIT License http://magicdawn.mit-license.org