use-router
v0.4.2
Published
router for use-* middlewares
Downloads
1,344
Maintainers
Readme
router for use-* middlewares
Features
- Support
use()
all()
get()
post()
and other http verbs - Support url pattern like express router:
use('/:name', ...)
- Support url rewrite in route
- Support nested routers
- Route are promise-based
Usage
const useServer = require('use-server')
const Router = require('use-router');
const app = useServer();
const router = Router();
router.use('/a', async (req, resp, next)=>{
await next();
})
app.use(router)
API
Router({params: object})
router.use|all|get|post|...([pattern], ...middlewares)
License
Licensed under MIT
Copyright (c) 2016 kiliwalk