express-remove-route
express-remove-route copied to clipboard
Delete a route in express at runtime.
The following 3 lines removes endpoints: ``` function deleteUserRouter(endpoint: string) { app.stack = app.stack.filter((app) => app.route.path !== `/${endpoint}`); } ``` Why have a whole package to do this
TypeScript enablement: added definition file and tweaked the package to ensure usage in order to better integrate in TypeScript contexts; this required adding the @types/express package as an optional dependency...
layer name should be `bound dispatch`
The package.json doesn't list any dependencies, but there are dependencies.
Looks like, after making code changes, the package.json wasn't updated so, if I `npm install …` I still get old code
1.if a uri not exist,but use removeRoute(app,uri),it will remove last routers,so i think you should to check idx > 0, ``` idx = stack.indexOf(route); stack.splice(idx, 1); ```
Hi! The error happened after executing the removeRoute a second time using a different path. (version 0.1.1) TypeError: Cannot read property 'route' of null at removeRoute (/git/documentcloud-ui/node_modules/express-remove-route/index.js:5:18)