express-routes-autoloader
v1.0.1
Published
A simple easy to use asynchronous autoloader, drop-in, configure & BOOM!
Downloads
35
Maintainers
Readme
express-routes-autoloader
A simple easy to use asynchronous autoloader, drop-in, configure & BOOM!
In your express project directory.
$ npm install express-routes-autoloader
right after you initialize express in (app|index).js (or whatever's your file with the routes definition)
var autoloader = require('express-routes-autoloader'),
path = require('path');
var app = express();
new autoloader(path.join(__dirname, 'path/to/routes')).load(app); //I just recommend using path, because of the relative URLs
And that's all folks!
What this does? It automatically generates routes for you based on your "routes" directory structure
so for a directory structure like,
- routes
|
|- website
|- deeper
|- wow.js
|- much.js
|- very_shibe.js
|- api
|- nice.js
It'll automatically generates routes to quickly get you up and running!
/website/deeper/wow
/website/much
/website/very_shibe.js
/api/nice
Nice "to have" things:
- Currently it needs to be required and then hooked with the express.js instance, will look into making it like other plugins
- Better autoloading probably
- Haven't encountered different encodings