Created
October 8, 2020 10:26
-
-
Save BCsabaEngine/bd3bcc780681297b9079126135ec2989 to your computer and use it in GitHub Desktop.
Re404 - move 404 error handler at the end of routing
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
Page404 = function (req, res, next) { res.status(404).render('page404', { title: "Oops 404!" }); } | |
app.re404 = () => { app.remove(Page404); app.use(Page404); } | |
app.re404(); | |
// and call app.re404() function after adding new routes (eg. when loading submodules) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment