Skip to content

magicdawn/impress-router-table

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

26 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

impress-router-table

Sails.js like routing for koa.js

Build Status Coverage Status npm version npm downloads npm license

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

CHANGELOG.md

License

the MIT License http://magicdawn.mit-license.org