Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

express-require-routes

0.0.1 • Public • Published

Express-Require-Routes

Require recursive routes from a directory and register them in express.

Installation

npm install express-require-routes

Usage

express-require-routes expects your route files to export a function with an express app argument.

Example

module.exports = function(app) {
    app.get('/users', ...);
    app.post('/users/{id}', ...);
}

To require one or more routes from a directory use the following code snippet (app is an express app):

var requireRoutes = require('express-require-routes');

requireRoutes('routes', app)

Attention Route directories have to specified relative to the current working dir (process.cwd()).

Keywords

none

install

npm i express-require-routes

Downloadsweekly downloads

4

version

0.0.1

license

none

last publish

collaborators

  • avatar