Basically I want to make all routes that come from any http method (get, post, put, ...) first pass by a method that will check if the user is authenticated, but this method should not be called when the user will authenticate (method POST
route /auth
) and when it will register (method POST
route /user
). Remember that I have other methods in the /user
route and other routes with the method POST
Would you like a solution that does not involve calling a function in all the required places, can you do something like router.all()
or router.use()
in one place?