redi

Stupidly simple regular expression HTTP dispatcher

redi

Stupidly simple regular expression HTTP dispatcher.

var http = require('http');
var redi = require('redi');
 
redi('^/post/(\\d+)$', function (reqrespost) {
  res.end('post ' + post);
});
 
redi('^/post/(\\d+)/comment/(\\d+)$', function (reqrespostcomment) {
  res.end('comment ' + comment + ' for post ' + post);
});
 
redi(/.*/, function (reqres) {
  res.end('default');
});
 
http.createServer(redi).listen(8000);

MIT