redi

Stupidly simple regular expression HTTP dispatcher

npm install redi
1 downloads in the last week
6 downloads in the last month

redi

Stupidly simple regular expression HTTP dispatcher.

Example

var http = require('http');
var redi = require('redi');

redi('^/post/(\\d+)$', function (req, res, post) {
  res.end('post ' + post);
});

redi('^/post/(\\d+)/comment/(\\d+)$', function (req, res, post, comment) {
  res.end('comment ' + comment + ' for post ' + post);
});

redi(/.*/, function (req, res) {
  res.end('default');
});

http.createServer(redi).listen(8000);

License

MIT

npm loves you