unpm-router

router for unpm, simple wrapper around routes that adds suport for querystrings and methods

unpm-router

HTTP router for unpm

var http = require('http')
 
var Router = require('unpm-router')
  , router
 
router = Router('/optional/root/directory')
 
router.add('method', 'route-to-match', handler_function)
 
http.createServer(function(reqres) {
  var result = router.match(req)
 
  if(result) {
    return result.fn(req, res, result)
  }
 
  res.writeHead(404)
  res.end('not found')
}).listen(4444)

Internally, unpm-router uses routes for route matching, so all of its handy pattern matching functionality is available.

MIT