connect-route
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/connect-route package

0.1.5 • Public • Published

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 (req, res, next) {
        res.end('index');
    });
 
    router.get('/home', function (req, res, next) {
        res.end('home');
    });
 
    router.get('/home/:id', function (req, res, next) {
        res.end('home ' + req.params.id);
    });
 
    router.post('/home', function (req, res, next) {
        res.end('POST to home');
    });
}));
 
app.listen(3000);

Readme

Keywords

Package Sidebar

Install

npm i connect-route

Weekly Downloads

3,024

Version

0.1.5

License

none

Last publish

Collaborators

  • baryshev