Performant radix-trie router for Zeit's Micro.
Fork of yoshuawuyts' server-router, modified for compatibility with Micro.
const MicroServerRouter = require('micro-server-router')
const router = new MicroServerRouter()
router.route('POST', '/hello', () => 'world')
router.route('GET', '*', () => 'nothing')
module.exports = router.start()
Create a new router with opts.
Register a new route with an HTTP method name and a routename. Can register
multiple handlers by passing an array of method names. params
contains
matched partials from the route.
Match a route on a router.
Return a function that can be passed directly to Micro.
$ npm install micro-server-router
- server-router - original version
- wayfarer - vanilla radix-trie router
- nanorouter - client-side radix-trie router