Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
simple router for journeyman module
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
test
.gitignore
.travis.yml
README.md
example.js
index.js
package.json
route.js

README.md

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();
Something went wrong with that request. Please try again.