Socket
Socket
Sign inDemoInstall

express-routes-group

Package Overview
Dependencies
1
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    express-routes-group

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


Version published
Weekly downloads
8
increased by166.67%
Maintainers
1
Install size
1.63 MB
Created
Weekly downloads
 

Readme

Source

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

FAQs

Last updated on 29 Nov 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc