express-routes-loader
A simple Express App utility to setup routes for the server.
Install
sudo npm install --save express-routes-loader
Usage
var path = ;var app = ;var routesLoader = ;/*...preprocess...*/
Routes directory
routes_dir
- The second parameter passed into the loader function.
Routes for the app server will be registered automatically according to the directory's structure -- a route path is made of dirnames along the path from the root routes dir to the file that exports a router.
In order to automate the registration, you should use a index.js
file to aggregate router-path mapping in each directories, and this can be easily done by utilizing npm module rqdir.
example for index file,
//the most simple waymoduleexports = __dirname; //or you need customize a littlemodule{ var router = ; var appCfg = app; router; return __dirname;};
Changelog
Latest:
0.0.1
- Initial Commit