Created
March 23, 2017 17:38
-
-
Save eduardobc88/2ab7f53a386535a87e227d98bce5d002 to your computer and use it in GitHub Desktop.
Express remove route
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function express_remove_route(router_path,callback) { | |
express_stack = router.stack; | |
console.log("================= express_remove_route =================="); | |
express_stack.forEach(function(route_layer){ | |
if( !route_layer ) return; | |
if( route_layer.route.path.indexOf(router_path) >= 1 ) { | |
//console.log(router_path,route_layer.route.path.indexOf(router_path)); // log layer | |
idx = express_stack.indexOf(route_layer); | |
//console.log("IDX",idx); // id to remove layer | |
express_stack.splice(idx, 1); | |
} | |
}); | |
console.log("================= express_remove_route =================="); | |
callback(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment