No description, website, or topics provided.
JavaScript
Switch branches/tags
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
.travis.yml
LICENSE
README.md
index.js
package.json

README.md

unpm-router

HTTP router for unpm

Build Status

usage

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(req, res) {
  var result = router.match(req)

  if(result) {
    return result.fn(req, res, result)
  }

  res.writeHead(404)
  res.end('not found')
}).listen(4444)

notes

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

license

MIT