express-routing-loader

Loader for Express web server router

express-routing-loader

Routing loader for NodeJS Express Web framework

$ npm install express-routing-loader

In your app.js file

Before app.set('port', process.env.PORT || 3000);

add line app.set('APP_DIR', __dirname);

After app.use(app.router);

add line require('express-routing-loader')(app);

Add routes.json file to your directory routes

Create catalogs

  • controllers
  • helpers
  • middleware
[
  ["route", "controller#action"],
  ["route", "controller#action", "method"],
  ["route", "middlewareFile#middlewareFunc", "controller#action", "method"]
]

You may use more than one middleware, just write it in order you need to call.

You may don't specify method, default will be get

You may specify more than one method, wrote it divided by | character, "post|patch"

  • add examples
  • add configure parameters to function to specify directories from which load
  • add dynamic helpers support
  • add to load express param routes