Express.js Route Grouping

Usage no npm install needed!

<script type="module">
  import expressGroupRoute from '';


Initialize Router

var app = require("express-group-router");

To Specify the API Version, this will add prefix to the routes if specified

app.version = "v3";

To Group Routes with a prefix"/users", function(){"/create", userController.create);"/login", userController.login);
app.get("/get", userController.get);


To Add a middileware to a group, supprts Array of Middlewares / Signle"/users", function(){"/create", userController.create);
app.get("/get", userController.get);

}, Middlewares.Auth);

Middlewares can be added to specific routes as well"/updateTasks", taskController.update, Middlewares.Auth);


npm install express-group-router


Don't forget to return app.router from your route file.

module.exports = app.router;


  • Eshant Sahu

MIT Licenced

Update in version 2.0.1

Support for nested grouping