DEV Community

Discussion on: 🛑 You don't need passport.js - Guide to node.js authentication ✌️

Collapse
 
tomerl101 profile image
Tomer

Great article! But what are the params in .get(...) ? I only know it is path and cb.

How from isAuth you go to the next middleware ? Thanks

Collapse
 
santypk4 profile image
Sam

The parameters in between the path and the callback/controller are the Middlewares.

Those are functions that are executed before the route callback, and have access to req and res objects of express.
Middlewares can be used for anything you want, a few examples: check user roles, API Input validation, log specific information, add timestamps of last user's activity, etc.

Here is more information.
expressjs.com/en/guide/using-middl...