1.0.0 • Published 6 years ago

auto-routes-express v1.0.0

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

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