connect-route

Simple and fast router for Connect

About

Simple and fast router for Connect

Installation

npm install connect-route

Usage

var
    connectRoute = require('connect-route'),
    connect = require('connect'),
    app = connect();
 
app.use(connectRoute(function (router) {
    router.get('/', function (reqresnext) {
        res.end('index');
    });
 
    router.get('/home', function (reqresnext) {
        res.end('home');
    });
 
    router.get('/home/:id', function (reqresnext) {
        res.end('home ' + req.params.id);
    });
 
    router.post('/home', function (reqresnext) {
        res.end('POST to home');
    });
}));
 
app.listen(3000);