Skip to content

Latest commit

 

History

History
40 lines (27 loc) · 730 Bytes

README.md

File metadata and controls

40 lines (27 loc) · 730 Bytes

Rudder

Build Status

The simple little router for Journeyman

Example Usage

var Journeyman = require('journeyman');
var Rudder = require('./index');

var rudder = new Rudder();

function mw1(req, res, next) {
  res.write("HERE COMES THE MIDDLEWARE\n");
  next();
}

rudder.get(/^\/test\/(\d+)$/, mw1, function(req, res, number) {
  res.write(number + "\n");
  res.end();
});

var server = new Journeyman(3000);

server.use(rudder.middleware());

server.use(function(req, res, next) {
  res.write(req.url + "\n");
  res.write(req.method + "\n");
  next();
});

server.listen();