auto-routes-express

1.0.0 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i auto-routes-express

Weekly Downloads

4

Version

1.0.0

License

MIT

Unpacked Size

19.3 kB

Total Files

12

Last publish

Collaborators

  • adoug