1.5.0 • Published 6 years ago

express-load-routers v1.5.0

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

express-load-routers

Load routers from specific folders for Express 4.x

Install

npm i express-load-routers

Usage

const path = require('path');
const express = require('express');
const loadRouters = require('express-load-routers');

const app = express();

app.use(loadRouters('./routes'));

Options

loadRouters(directory, options);
optiontypedefaultdecription
excludeArray'_*'This array contain match patterns that will excludes.

Router

ex) routes/sample.js -> http://localhost/sample/

module.exports = router = require('express').Router();
router.get('/', (req, res, next)=>{
  res.send('OK');
});

ex) routes/camel/index.js -> http://localhost/camel/

ex) routes/one/two.js -> http://localhost/one/two/three/

module.exports = router = require('express').Router();
router.get('/three', (req, res, next)=>{
  res.send('OK');
});

License

MIT License.

1.5.0

6 years ago

1.2.0

6 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago