1.0.4 • Published 6 years ago

express-routes-group v1.0.4

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

Express routes group

Simple way to group your routes in Express + chaining it.

If you want to prefix all routes with a certain URL you can use the group method as following:

var app = require('express');
require('express-group-routes');
 
app
  .group("/api/v1", (router) => {
      router.get("/path1", controller1); // /api/v1/login 
  })
  .group("/api/v2", (router) => {
      router.get("/path2", controller2); // /api/v2/path2 
  });

In case you don't want to add a prefix but still need to group certain routes you can leave the first parameter and go straight for the function:

var app = require('express');
require('express-group-routes');
 
app
  .group((router) => {
      router.use(middleware1);
  })
  .group((router) => {
      router.use(middleware2);
  });
  • Inspired from express-group-routes
1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago