fix/middleware+404 handling block plans
This commit is contained in:
1 file changed
+1
-1
@@ -13,7 +13,7 @@ const userRoutes = userRouter.stack.map((layer) => layer.route.path.split("/")[1
|
|||||||
const createMiddleware = (users) => {
|
const createMiddleware = (users) => {
|
||||||
return async (req, res, next) => {
|
return async (req, res, next) => {
|
||||||
// Redirect not found pages to 404 page
|
// Redirect not found pages to 404 page
|
||||||
if (!userRoutes.includes(req.url.substring(1))) {
|
if (!userRoutes.includes(req.url.split("/")[1])) {
|
||||||
return res.status(status.NotFound).redirect("/notFound");
|
return res.status(status.NotFound).redirect("/notFound");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user