Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

express-routing

t0k0sh113deprecated0.0.2

this is deprecated

Routing helper for Express

route, router, express

readme

express-routing

Build Status

Loads expressjs routes from a specified directory. The key benefit to this is that you don't have to define each and every route in eg. app.js. Just tell expressjs to load all routes and when adding a new file in your routes directory it will get automatically loaded (next time you start node).

Install by running:

npm install express-routing --save

Default loads all *.js files in the /routes/ directory.

When loading, pass in all dependencies needed for your routes

Usage:

var express = require('express');
var app = express();

var routing = require('express-routing')(app);
routing.load('./routes');

This require your routes to look something like this:

var express = require('express');
var router = express.Router();

/* GET home page. */
router.get('/', function(req, res) {
  res.render('index', { title: 'Express' });
});