npm.io
1.0.0 • Published 8 years ago

auto-routes-express

Licence
MIT
Version
1.0.0
Deps
0
Size
19 kB
Vulns
0
Weekly
0
Stars
1

auto-router

auto router by file path for express

auto-router

auto router by file path for express

if you have a file named user.js in routes/api, auto-router will do this:

app.use('/api/user', require('path/to/user.js'))

// for the file 'routes/index.js'
app.use('/', require('path/to/index.js'))

Install

 npm install auto-router --save-dev

Usage

const app = require('express')
const AutoRouter = require('auto-routes-express')

AutoRouter.init(app, path.join(__dirname, 'path/to/routes'))

Keywords