2.0.1-readme • Published 6 years ago

@abnerlin/express-routes-loader v2.0.1-readme

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
6 years ago

Express Routes Loader

Load all routes in directory.

Installation

npm install @abnerlin/express-routes-loader

Usage

const app = express();
const expressRouteLoader = require('@abnerlin/express-routes-loader')(app);
    
...

Load all routes in direcotry

expressRouteLoader.dir(path.join(__dirname, 'routes')); // which 'routes' is directory path.

Load routes with specify file

expressRouteLoader.file(path.join(__dirname, 'routes', 'auth')); // which 'routes/auth' is file path.

Export url path

const express = require('express');
const router = express.Router();

router.post('/login', function(req, res) {
        ...
});

router.root = '/auth';  // this is url path which must export.

module.exports = router;
2.0.1-readme

6 years ago

2.0.0-readme

6 years ago

2.0.0-rc.1

6 years ago

2.0.0

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago