redi

0.1.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i redi

Weekly Downloads

5

Version

0.1.0

License

MIT

Last publish

Collaborators

  • uggedal