0.0.4 • Published 8 years ago

routes-getter v0.0.4

Weekly downloads
1
License
ISC
Repository
-
Last release
8 years ago

routes-getter

Accessible routes in your ExpressJS application

Centered image

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-getter

Examples

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 application

API

loader.routers(options)

options

path

Required

Path to routes in your application folder.

app

Required

app should be instance of express

Tests

npm test

Contributing

Add unit tests for any new or changed functionality.

License

ISC

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago