1.0.6 • Published 5 years ago
koa-router-helper v1.0.6
@jkinfeng/koa-router-helper
Autoload router files for koa-router.
Installation
npm i koa-router-helper
API Reference
Param | Type | Default Value | Description |
---|---|---|---|
$options | Object | ||
$options.path | String | process.cwd() | router base path |
$options.regular | Regular expression | /\.router.js$/ | router files match |
Example
Basic usage:
const koa = require('koa');
const autoloadRouter = require('koa-router-helper');
const app = new koa();
app.use(autoloadRouter());
//...
app.use(autoloadRouter({
path: 'Router base path',
regular: /Regular expression matching route files/
}));
//...
Contributing
Please submit all issues and pull requests to the jkinfeng/koa-router-helper repository!
Support
If you have any problem or suggestion please open an issue here.