Problem Statement
What is Passport in Node.js and what is it used for?
Explanation
Passport.js is a flexible authentication middleware for Node.js. It supports local logins and social logins (Google, Facebook, GitHub). It simplifies user authentication by using modular strategies.
Code Solution
SolutionRead Only
const passport=require('passport');
app.post('/login',passport.authenticate('local'),(req,res)=>res.send('Logged in'));