03 - Set up Passport -  Advanced Node and Express - freeCodeCamp
Channel: Ganesh H
Date: 30/07/2020

We need to set up some node modules to store cookies for our sessions (express-session) and for authentication (passport). We have to mount these as middlewares for all routes.

Link to Challenge : https://www.freecodecamp.org/learn/quality-assurance/advanced-node-and-express/set-up-passport
Written Guide: https://www.notion.so/ganeshh123/Set-up-Passport-ac75ec24dd0d417492be86a5049d6ba5

Full Playlist for this course : https://www.youtube.com/playlist?list=PLhGp6N0DI_1RL9djhgSH65pZhJ6xSyKX8
All Writen Guides for this course : https://www.notion.so/ganeshh123/ccf6039186334f83a54c1c9216f30e3c
All My Tutorials can be found at : https://www.notion.so/Tutorials-Ganesh-H-293ea420d34a464f9a1907e0405b5f26

00:00 - Introduction
00:32 - Express Session Setup - session()
https://www.npmjs.com/package/express-session#sessionoptions
03:32 - How Session Storage Works
06:20 - Passport Setup
passport.initialize()
Returns a middleware which must be called at the start of connect or express based apps. This sets req._passport, which passport uses all over the place.
https://github.com/jwalton/passport-api-docs#passportinitialize
passport.session()
"If your application uses persistent login sessions, passport.session() middleware must also be used." Should be after your session middleware. This returns a middleware which will try to read a user out of the session; if one is there, it will store the user in req.user, if not, it will do nothing.
https://github.com/jwalton/passport-api-docs#passportsessionoptions
08:07 - Challenge Solution

-————————————————————————————————————-
Node.js is an open-source, cross-platform, JavaScript runtime environment that executes JavaScript code outside a web browser. Node.js lets developers use JavaScript to write command line tools and for server-side scripting—running scripts server-side to produce dynamic web page content before the page is sent to the user's web browser. 

Express.js, or simply Express, is a web application framework for Node.js. It is designed for building web applications and APIs. It has been called the de facto standard server framework for Node.js. Express runs between the server created by Node.js and the frontend pages of a web application. Express also handles an application's routing.

freeCodeCamp (also referred to as “Free Code Camp”) is a non-profit organization that consists of an interactive learning web platform, an online community forum, chat rooms, online publications and local organizations that intend to make learning web development accessible to anyone. Beginning with tutorials that introduce students to HTML, CSS and JavaScript, students progress to project assignments that they complete either alone or in pairs. Upon completion of all project tasks, students are partnered with other nonprofits to build web applications, giving the students practical development experience.

freeCodeCamp (also referred to as “Free Code Camp”) is a non-profit organization that consists of an interactive learning web platform, an online community forum, chat rooms, online publications and local organizations that intend to make learning web development accessible to anyone. Beginning with tutorials that introduce students to HTML, CSS and JavaScript, students progress to project assignments that they complete either alone or in pairs. Upon completion of all project tasks, students are partnered with other nonprofits to build web applications, giving the students practical development experience.

Thanks for Watching!