express-route-fs
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

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

Option Description Default
routerDir Load router files from this directory. ./routes/

Package Sidebar

Install

npm i express-route-fs

Weekly Downloads

14

Version

0.1.0

License

MIT

Last publish

Collaborators

  • kripod