Passport adds a method to each request called isAuthenticated() which we can use to check if the user is logged in before accessing certain routes, and if not, redirect them to do so.
Link to Challenge : https://www.freecodecamp.org/learn/qu...
Written Guide: https://www.notion.so/ganeshh123/Crea...
Full Playlist for this course : • Advanced Node and Express - freeCodeCamp
All Writen Guides for this course : https://www.notion.so/ganeshh123/ccf6...
All My Tutorials can be found at : https://www.notion.so/Tutorials-Ganes...
00:00 - Introduction
00:18 - Why this is needed
01:13 - Using Middleware to Solve the Problem
02:04 - Checking for the Sign In Cookie - isAuthenticated()
No docs for this method exist. Passport has crap documentation. Basically I think it returns true of the sign in cookie exists.
https://github.com/jaredhanson/passpo...
02:55 - Intercepting Routes with the Middleware
03:12 - Testing the Route
05:14 - 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!
Смотрите видео 08 - Create New Middleware - Advanced Node and Express - freeCodeCamp онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Ganesh H 04 Август 2020, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 918 раз и оно понравилось 17 людям.