express-routebuilder

Simple declarative route configuration for Express without leaky abstractions.

npm install express-routebuilder
19 downloads in the last week
49 downloads in the last month

express-routebuilder Build Status

Simple declarative route configuration for Express without leaky abstractions.

Example

var express = require('express');
var routeBuilder = require('express-routebuilder');
var app = express();

var routes = {
  all: {
    '*': [
      function (req, res, next) { console.log('yo'); next(); }
    ]
  },
  get: {
    '/': [
      function (req, res, next) { console.log('index middleware'); next(); },
      function (req, res) { res.send(200); }
    ]
  },
  post: {
    //...
  }
};

app.use(routeBuilder(express, routes));
app.use('/namespaced', routeBuilder(express, routes));

Release History

  • 2012-01-16 - v0.1 - initial release
npm loves you