express-route-fs
v0.1.0
Published
File system-based approach for handling routes in Express.
Downloads
91
Readme
express-route-fs
File system-based approach for handling routes in Express.
Installation
$ npm install express-route-fs --save
Features
- Automatically load router files from a specifiable directory
- Easily organize and find your routers by using subdirectories for them
- Lightweight API
Usage
Syntax: routeFs(app[, options])
Define your routes in a directory
- It is encouraged to use separate files for each page in order to easily debug routing issues.
- Subdirectories can be used
- An
index.js
file of a directory sets the routing base to the directory's path.
- An
Initialize the routers automatically
var express = require('express'); var routeFs = require('express-route-fs'); var app = express(); routeFs(app, { routerDir: __dirname + '/routes' });
Options
| Option | Description | Default |
|-------------|----------------------------------------|-----------|
| routerDir
| Load router files from this directory. | ./routes/ |