express-routing-loader

0.0.1 • Public • Published

express-routing-loader

Routing loader for NodeJS Express Web framework

Installation

$ npm install express-routing-loader

Example usages:

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

routes.json fromat:

[
  ["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"

Todo plans:

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

Readme

Keywords

none

Package Sidebar

Install

npm i express-routing-loader

Weekly Downloads

1

Version

0.0.1

License

Mit

Last publish

Collaborators

  • lonely_soul.ua