Express Controller Routing
A simple way to create and test Express routes
Install
$ npm install express-controller-routing
Usage
Create a new Express controller file (./myRoute.js)
const myFirstMiddleware = { ;}; const mySecondMiddleware = { ;}; moduleexports = '/': { // do something } '/my/path/to/:something': { // do something } // you can also use an array if you need to use middlewares post: myFirstMiddleware mySecondMiddleware { } ;
Register this newly created controller in app.js
const controller = ;const express = ;const app = ; // expose all routes defined in ./myRoute.jsapp; // or if you need all routes in to be prefixedapp;