Web Dev Roadmap for Beginners (Free!): https://bit.ly/DaveGrayWebDevRoadmap
Learn how to apply middleware to a MERN Stack Project. The backend of a MERN Stack Project is a Node.js & Express REST API. In this tutorial, we'll apply built-in middleware, custom middleware and 3rd party middleware.
⭐ Become a full-stack web dev with Zero To Mastery Courses:
- Advanced React & Redux: https://bit.ly/AdvReactDev
- The Complete Node.js Developer: https://bit.ly/CompleteNodeJS
- Jr to Senior Web Dev Roadmap: https://bit.ly/WebDevRoadmap-JrtoSr
Subscribe https://bit.ly/3nGHmNn
Course Updates https://courses.davegray.codes/
Discord https://discord.gg/neKghyefqh
Buy Me A Coffee https://www.buymeacoffee.com/davegray
Follow Me On Social Media:
Github: https://github.com/gitdagray
Twitter: https://twitter.com/yesdavidgray
LinkedIn: https://www.linkedin.com/in/davidagray/
All Resources for this MERN Stack Project: https://github.com/gitdagray/mern_stack_course
Playlist for this MERN Stack Project Series: https://bit.ly/3Sn4EaI
Middleware in a MERN Stack Project | REST API Tutorial
(00:00) Intro
(00:11) Welcome
(00:20) What is Middleware?
(00:48) Quick Corrections & Starter Code
(01:56) Built-in Middleware
(04:00) Custom Log Middleware
(14:03) Custom Error Handler Middleware
(16:56) cookie-parser 3rd party middleware
(18:10) Understanding CORS
(19:32) Setting up CORS middleware
(21:02) Securing CORS for our MERN Stack Project
Suggested Pre-requisites for this MERN course:
Node.js for Beginners full course: https://youtu.be/f2EqECiTBL8
React JS for Beginners full course: https://youtu.be/RVFAyFWO4go
Redux Toolkit for Beginners full course: https://youtu.be/NqzdVN2tyvQ
React Login Playlist: https://www.youtube.com/playlist?list=PL0Zuz27SZ-6PRCpm9clX0WiBEMB70FWwd
Tutorial References:
Express.js middleware: http://expressjs.com/en/guide/using-middleware.html#using-middleware
date-fns: https://www.npmjs.com/package/date-fns
uuid: https://www.npmjs.com/package/uuid
cookie-parser middleware: https://www.npmjs.com/package/cookie-parser
CORS middleware: https://www.npmjs.com/package/cors
Was this MERN Stack middleware tutorial helpful? If so, please share. Let me know your thoughts in the comments.
#mern #stack #middleware