jporfirio / courses

0 stars 0 forks source link

change protected routes to use middleware for auth #2

Open jporfirio opened 7 years ago

jporfirio commented 7 years ago

router.use works like app.use therefore one can chain middleware to authenticate specific routes https://expressjs.com/en/4x/api.html#router.use

jporfirio commented 7 years ago

maybe instead of using it on the router.use, use auth middleware on all put, delete and post requests on app.js (entry point) write line app.delete with all routes and etc