Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/diegorbaquero/express-route-autoloader
Automatically loads routes from a directory structure
https://github.com/diegorbaquero/express-route-autoloader
autoloader express expressjs loader route router
Last synced: 23 days ago
JSON representation
Automatically loads routes from a directory structure
- Host: GitHub
- URL: https://github.com/diegorbaquero/express-route-autoloader
- Owner: DiegoRBaquero
- License: mit
- Created: 2017-12-20T17:33:25.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-04-25T23:47:37.000Z (7 months ago)
- Last Synced: 2024-05-13T16:24:40.431Z (6 months ago)
- Topics: autoloader, express, expressjs, loader, route, router
- Language: JavaScript
- Size: 117 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# express-route-autoloader [![npm](https://img.shields.io/npm/v/express-route-autoloader.svg?style=flat-square)]() [![npm](https://img.shields.io/npm/dm/express-route-autoloader.svg?style=flat-square)]() [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg?style=flat-square)](https://standardjs.com) [![npm](https://img.shields.io/npm/l/express-route-autoloader.svg?style=flat-square)](LICENSE)
Automatically loads routes from a directory structure
[![Greenkeeper badge](https://badges.greenkeeper.io/DiegoRBaquero/express-route-autoloader.svg)](https://greenkeeper.io/)
[![Travis branch](https://img.shields.io/travis/DiegoRBaquero/express-route-autoloader/master.svg?style=flat-square)]()
[![Known Vulnerabilities](https://snyk.io/test/github/diegorbaquero/express-route-autoloader/badge.svg?style=flat-square)](https://snyk.io/test/github/diegorbaquero/express-route-autoloader)## Install
```
npm i -S express-route-autoloader
or
npm install --save express-route-autoloader
```## Use
Put your routes in `src/routes`:
```
src/
- routes/
--- index.js -> maps to /
--- auth.js -> maps to /auth
--- v1/
----- model1.js -> maps to /v1/model1
----- model2.js -> maps to /v1/model2
```Load routes in your app:
```js
const express = require('express')
const routeLoader = require('express-route-autoloader')const app = express()
routeLoader(app)
```## Related
- [express-sequelize-crud-router](https://github.com/DiegoRBaquero/express-sequelize-crud-router)
- [express-debug-async-wrap](https://github.com/DiegoRBaquero/express-debug-async-wrap)
- [sequelize-express-findbyid](https://github.com/DiegoRBaquero/sequelize-express-findbyid)## License
MIT Copyright © [Diego Rodríguez Baquero](https://diegorbaquero.com)