0.1.0 • Published 10 years ago

express-route-fs v0.1.0

Weekly downloads
8
License
MIT
Repository
github
Last release
10 years ago

express-route-fs

File system-based approach for handling routes in Express.

NPM Version Travis CI Build

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])

  1. 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.
  2. Initialize the routers automatically

    var express = require('express');
    var routeFs = require('express-route-fs');
    
    var app = express();
    routeFs(app, { routerDir: __dirname + '/routes' });

Options

OptionDescriptionDefault
routerDirLoad router files from this directory../routes/