0.0.4 • Published 9 years ago
routes-getter v0.0.4
routes-getter
Accessible routes in your ExpressJS application
![]()
An easy way of working with your routes in ExpressJS applications. It walks through your routes folder and imports them to your project.
Note - It does not walk through the middlewares folder in your routes folder. Since they are used and shared by routes as further middlewares.
Table of Contents
- Installation
- Examples
- API
Installation
npm install -g routes-getterExamples
Assuming the src directory to be the application folder, this is how you will define the routes
// src/routes/index.js
module.exports = (app) => {
app.get('/', (req, res) => x{
res.render('../views/index.html');
});
}server.js file in your app directory.
const express = require('express');
const loader = require('routes-getter');
const app = express();
loader.routers(__dirname + '/routes', app); // Loads the routes in your applicationAPI
loader.routers(options)
options
path
Required
Path to routes in your application folder.
app
Required
app should be instance of express
Tests
npm testContributing
Add unit tests for any new or changed functionality.
License
ISC