route-blocker ·
A middleware for expressjs to block or unblock a route
Install
Using npm
npm install route-blocker
Using yarn
yarn add route-blocker
Usage
In server.ts (or the file where app and routes are defined)
; ;;; app.usemyRoute, routeBlocker.middlewaresubRouteToBlock;app.getmyRoute, myRouteFunction;
In the file where the route blocking should be enabled/disabled
;; routeBlocker.disableRoutesubRouteToBlock; // disable route // do something routeBlocker.enableRoutesubRouteToBlock; // enable route
To remove all route blockings
routeBlocker.clearBlockings;
Note
See the source for more details
License
route-blocker is MIT licensed.