mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-13 17:22:49 +00:00
Add catch-all for invalid paths
res.route is the currently-matched route. If nothing has been matched by this point (route = undefined), we have an invalid route.
This commit is contained in:
@@ -420,6 +420,14 @@ if(isLocalEnvironment){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Catch-all route for invalid routes
|
||||||
|
app.use((req, res, next) => {
|
||||||
|
if (!req.route)
|
||||||
|
return res.redirect('/');
|
||||||
|
|
||||||
|
return next();
|
||||||
|
});
|
||||||
|
|
||||||
//Render the page
|
//Render the page
|
||||||
const templateFn = require('./../client/template.js');
|
const templateFn = require('./../client/template.js');
|
||||||
const renderPage = async (req, res)=>{
|
const renderPage = async (req, res)=>{
|
||||||
|
|||||||
Reference in New Issue
Block a user