ExpressJS, protected routes.
Hi everyone,
Is there better way to have protected routes, in expressjs, I'm sensing some code messy while code expands while i'v to repeat the middleware to all the routes.
Any better way to initialize like in Laravel group routes. My code below.
router.post("/create", controller.authController.isAuthenticated, controller.articleController.create)
router.get("/edit/:id", controller.authController.isAuthenticated, controller.articleController.edit)
router.put("/update/:id", controller.authController.isAuthenticated, controller.articleController.update)
router.delete("/delete/:id", controller.authController.isAuthenticated, controller.articleController.delete)