0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 14:12:40 +00:00

revert api catch on wrong route middleware

This commit is contained in:
Víctor Losada Hernández
2024-12-14 20:59:51 +01:00
parent d573129f31
commit 5e5c637c79

View File

@@ -346,7 +346,7 @@ app.get('/user/:username', async (req, res, next)=>{
return next();
});
//Rename Brews
//Change author name on brews
app.put('/api/user/rename', async (req, res) => {
const { username, newUsername } = req.body;
@@ -538,14 +538,11 @@ app.get('/vault', asyncHandler(async(req, res, next)=>{
//Send rendered page
app.use(asyncHandler(async (req, res, next) => {
if (!req.route && !req.path.startsWith('/api/')) {
return res.redirect('/');
}
if (!req.route) return res.redirect('/'); // Catch-all for invalid routes
const page = await renderPage(req, res);
if (!page) return;
res.send(page);
const page = await renderPage(req, res);
if(!page) return;
res.send(page);
}));
//Render the page