express-highway

Powered Express router with namespaces, resources and better middleware support.

express-highway

Extends express router with some goodies such as namespacing, resources and better middleware handling.

Install with npm:

npm install --save express-highway
var express = require('express');
var app = express();
var highway = require('express-highway')(app);
 
// Require your routes file and call it in highway's context
var routes = require('./routes');
routes.call(highway);
 
app.listen(3000);
 
module.exports = function() {
 
  this.get('/', HomeController, 'index');
 
  this.namespace('/api', function() {
 
    this.get('/', 'ApiController', 'home');
 
    this.namespace('/v1', function() {
 
      this.resource('/user', UserV1Controller);
 
    });
 
    this.namespace('/v2', function() {
 
      this.resource('/user', UserV2Controller, customBlueprint);
 
    });
 
  });
 
};

RESTful resources follow a default blueprint defined in lib/resource.js. You can easily override this by passing a custom blueprint as the third argument to this.resource().

NOTICE: Routes in controller that don't adhere to the blueprint will be IGNORED;

From the repo root:

npm install
npm test