package
Server router
npm install server-routerGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Performant radix-trie router for streaming servers.
var serverRouter = require('server-router')
var http = require('http')
var router = serverRouter({ default: '/404' })
router.route('GET', '/hello', function (req, res, params) {
res.end('hello world')
})
router.route('PUT', '/hello/:name', function (req, res, params) {
res.end('hi there ' + params.name)
})
router.route('', '/404'
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 http.createServer() and
calls router.match().
$ npm install server-routerperguth
idrathernotgetmails@gmail.com
Estimated unpacked size across 7 packages.
468.0 kB
Includes dependencies.
3 direct · 1 outdated