Web Dev Roadmap for Beginners (Free!): https://bit.ly/DaveGrayWebDevRoadmap
Learn how to apply Next.js middleware in Nextjs 13. You will learn about middleware at the edge runtime as well as middleware for route handlers and how to apply cors features without an extra dependency.
⭐ Become a full-stack web dev with Zero To Mastery Courses:
- Complete Next.js Developer: https://bit.ly/CompNextJSDev
- Advanced React: https://bit.ly/AdvReactDev
- Junior to Senior Dev Roadmap: https://bit.ly/WebDevRoadmap-JrtoSr
Subscribe https://bit.ly/3nGHmNn
Course Updates https://courses.davegray.codes/
Questions - Please post them to my 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/
Source Code: https://github.com/gitdagray/next-js-course
Playlist for this Next.js Course: https://bit.ly/dg-nextjs
Next.js Middleware & Cors | Nextjs 13 tutorial
(00:00) Intro
(00:05) Welcome
(00:27) Starter Code
(01:00) Quick follow-up on last lesson
(03:02) Next.js Middleware
(04:47) Middleware file
(07:17) Matching paths
(11:20) Matching with conditionals
(13:10) Rate limiting middleware
(21:33) Cors & Next.js 13
(25:41) Applying Cors middleware features
(37:01) Wrap up
Tutorial References:
Next.js Official Site: https://nextjs.org/
Next.js 13 Beta Docs: https://beta.nextjs.org/docs
ES7 React Snippets Extension: https://marketplace.visualstudio.com/items?itemName=dsznajder.es7-react-js-snippets
NPM Limiter middleware: https://www.npmjs.com/package/limiter
Was this Next.js tutorial about how to middleware and cors helpful? If so, please share. Let me know your thoughts in the comments.
#nextjs #middleware #cors