troute

super fast tiny router

troute

super fast tiny router

$ npm insall troute

using troute is super simple

troute accepts a valid http method, a string or RegExp route, and a function fn(req, res, next) as a callback

  • method - a valid http method
  • route - a string or RegExp for route matching
  • fn - a callback function when the route is matched

see sregex for more information defining string and RegExp routes

example

require('http').createServer(troute('GET', '/home', function (reqres) {
  res.end('+1');
})).listen(8000);

MIT