mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-02 17:12:45 +00:00
revert api catch on wrong route middleware
This commit is contained in:
@@ -346,7 +346,7 @@ app.get('/user/:username', async (req, res, next)=>{
|
|||||||
return next();
|
return next();
|
||||||
});
|
});
|
||||||
|
|
||||||
//Rename Brews
|
//Change author name on brews
|
||||||
app.put('/api/user/rename', async (req, res) => {
|
app.put('/api/user/rename', async (req, res) => {
|
||||||
const { username, newUsername } = req.body;
|
const { username, newUsername } = req.body;
|
||||||
|
|
||||||
@@ -538,14 +538,11 @@ app.get('/vault', asyncHandler(async(req, res, next)=>{
|
|||||||
|
|
||||||
//Send rendered page
|
//Send rendered page
|
||||||
app.use(asyncHandler(async (req, res, next) => {
|
app.use(asyncHandler(async (req, res, next) => {
|
||||||
if (!req.route && !req.path.startsWith('/api/')) {
|
if (!req.route) return res.redirect('/'); // Catch-all for invalid routes
|
||||||
return res.redirect('/');
|
|
||||||
}
|
|
||||||
|
|
||||||
const page = await renderPage(req, res);
|
const page = await renderPage(req, res);
|
||||||
if (!page) return;
|
if(!page) return;
|
||||||
|
res.send(page);
|
||||||
res.send(page);
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
//Render the page
|
//Render the page
|
||||||
|
|||||||
Reference in New Issue
Block a user