1.0.3 • Published 6 years ago

express-route-autoloader v1.0.3

Weekly downloads
12
License
MIT
Repository
github
Last release
6 years ago

express-route-autoloader npm npm JavaScript Style Guide npm

Automatically loads routes from a directory structure

Greenkeeper badge Travis branch Known Vulnerabilities NSP Status

Install

npm i -S express-route-autoloader
or
npm install --save express-route-autoloader

Use

Put your routes in src/routes:

src/
- routes/
--- index.js   -> maps to /
--- auth.js    -> maps to /auth
--- v1/
----- model1.js -> maps to /v1/model1
----- model2.js -> maps to /v1/model2

Load routes in your app:

const express = require('express')
const routeLoader = require('express-route-autoloader')

const app = express()
routeLoader(app)

Related

License

MIT Copyright © Diego Rodríguez Baquero