Next.js Middleware & Cors | Nextjs 13 tutorial

Dave Gray April 14, 2023
Video Thumbnail

About

Web Development tutorials with full courses on HTML, CSS, JavaScript, React, Node.js and more! My goal is to help you learn how to build the web. Teaching helps me learn, too. I work full-time as a Solutions Architect / Developer and part-time as a university web dev instructor. Thank you for subscribing, supporting my channel and sharing the videos you think may help others. Keep striving for progress over perfection. And a little progress every day goes a very long way. Milestones: July 20, 2020 - 1st video Jan 1, 2021 - 1k subs April 2021 - 4k watch hours Nov 2021 - 10k subs Jan 21, 2022 - Video at 100k views Feb 16, 2022 - 100k watch hours Feb 19, 2022 - 1m views Dec 13, 2022 - 100k subs Dec 2022 - Over 1m views in 1 month April 7, 2023 - 10m views May 26, 2023 - 1m watch hours Sept 22, 2023 - Video at 1m views Dec 25, 2023 - 250k subs

Video Description

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. 💖 Support me on Patreon ➜ https://patreon.com/davegray ⭐ 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

You May Also Like

Essential Spraying Gear

AI-recommended products based on this video

Loading...
Paint Sprayer Electric Spray Gun: 700W Spray Paint Gun with 1200ml Container, 4 Nozzles & 3 Patterns, Adjustable Air Flow, Easy Cleaning for House Painting, Furniture, Fence, Walls, Door (Red)

Paint Sprayer Electric Spray Gun: 700W Spray Paint Gun with 1200ml Container, 4 Nozzles & 3 Patterns, Adjustable Air Flow, Easy Cleaning for House Painting, Furniture, Fence, Walls, Door (Red)

(126)
$65.99
FREE delivery Wed, Aug 20
400+ bought in past month
Loading...
Paint Sprayer Electric Spray Gun: 700W Spray Paint Gun with 1200ml Container, 4 Nozzles & 3 Patterns, Adjustable Air Flow, Easy Cleaning for House Painting, Furniture, Fence, Walls, Door (Royal Blue)
Best Seller

Paint Sprayer Electric Spray Gun: 700W Spray Paint Gun with 1200ml Container, 4 Nozzles & 3 Patterns, Adjustable Air Flow, Easy Cleaning for House Painting, Furniture, Fence, Walls, Door (Royal Blue)

(97)
$69.99
PrimeFREE delivery Sat, Jun 14
Loading...
Cordless Paint Sprayer for Dewalt 20V MAX Battery.Paint Spray Gun with Powerful Motor and 4 Copper Nozzle.650w Electric HVIP Sprayer for House Painting,Furniture, Wall, Door.(NOT Battery)

Cordless Paint Sprayer for Dewalt 20V MAX Battery.Paint Spray Gun with Powerful Motor and 4 Copper Nozzle.650w Electric HVIP Sprayer for House Painting,Furniture, Wall, Door.(NOT Battery)

(5)
$74.99
FREE delivery Wed, Aug 20
50+ bought in past month
Loading...
Cordless Paint Sprayer for Dewalt 20V MAX Battery.Paint Spray Gun with Powerful Motor and 4 Copper Nozzle.650w Electric HVIP Sprayer for House Painting,Furniture, Wall, Door.(NOT Battery)

Cordless Paint Sprayer for Dewalt 20V MAX Battery.Paint Spray Gun with Powerful Motor and 4 Copper Nozzle.650w Electric HVIP Sprayer for House Painting,Furniture, Wall, Door.(NOT Battery)

(5)
$74.99
FREE delivery Wed, Aug 20
50+ bought in past month
Loading...
Paint Sprayer Electric Spray Gun: 700W Spray Paint Gun with 1200ml Container, 4 Nozzles & 3 Patterns, Adjustable Air Flow, Easy Cleaning for House Painting, Furniture, Fence, Walls, Door (Red)

Paint Sprayer Electric Spray Gun: 700W Spray Paint Gun with 1200ml Container, 4 Nozzles & 3 Patterns, Adjustable Air Flow, Easy Cleaning for House Painting, Furniture, Fence, Walls, Door (Red)

(126)
$65.99
FREE delivery Wed, Aug 20
400+ bought in past month
Loading...
Paint Sprayer Electric Spray Gun: 700W Spray Paint Gun with 1200ml Container, 4 Nozzles & 3 Patterns, Adjustable Air Flow, Easy Cleaning for House Painting, Furniture, Fence, Walls, Door (Royal Blue)
Best Seller

Paint Sprayer Electric Spray Gun: 700W Spray Paint Gun with 1200ml Container, 4 Nozzles & 3 Patterns, Adjustable Air Flow, Easy Cleaning for House Painting, Furniture, Fence, Walls, Door (Royal Blue)

(97)
$69.99
PrimeFREE delivery Sat, Jun 14
Loading...
Cordless Paint Sprayer for Dewalt 20V MAX Battery.Paint Spray Gun with Powerful Motor and 4 Copper Nozzle.650w Electric HVIP Sprayer for House Painting,Furniture, Wall, Door.(NOT Battery)

Cordless Paint Sprayer for Dewalt 20V MAX Battery.Paint Spray Gun with Powerful Motor and 4 Copper Nozzle.650w Electric HVIP Sprayer for House Painting,Furniture, Wall, Door.(NOT Battery)

(5)
$74.99
FREE delivery Wed, Aug 20
50+ bought in past month
Loading...
Paint Sprayer Electric Spray Gun: 700W Spray Paint Gun with 1200ml Container, 4 Nozzles & 3 Patterns, Adjustable Air Flow, Easy Cleaning for House Painting, Furniture, Fence, Walls, Door (Red)

Paint Sprayer Electric Spray Gun: 700W Spray Paint Gun with 1200ml Container, 4 Nozzles & 3 Patterns, Adjustable Air Flow, Easy Cleaning for House Painting, Furniture, Fence, Walls, Door (Red)

(126)
$65.99
FREE delivery Wed, Aug 20
400+ bought in past month
Loading...
Paint Sprayer Electric Spray Gun: 700W Spray Paint Gun with 1200ml Container, 4 Nozzles & 3 Patterns, Adjustable Air Flow, Easy Cleaning for House Painting, Furniture, Fence, Walls, Door (Royal Blue)
Best Seller

Paint Sprayer Electric Spray Gun: 700W Spray Paint Gun with 1200ml Container, 4 Nozzles & 3 Patterns, Adjustable Air Flow, Easy Cleaning for House Painting, Furniture, Fence, Walls, Door (Royal Blue)

(97)
$69.99
PrimeFREE delivery Sat, Jun 14
Loading...
Cordless Paint Sprayer for Dewalt 20V MAX Battery.Paint Spray Gun with Powerful Motor and 4 Copper Nozzle.650w Electric HVIP Sprayer for House Painting,Furniture, Wall, Door.(NOT Battery)

Cordless Paint Sprayer for Dewalt 20V MAX Battery.Paint Spray Gun with Powerful Motor and 4 Copper Nozzle.650w Electric HVIP Sprayer for House Painting,Furniture, Wall, Door.(NOT Battery)

(5)
$74.99
FREE delivery Wed, Aug 20
50+ bought in past month
Loading...
Cordless Paint Sprayer for Dewalt 20V MAX Battery.Paint Spray Gun with Powerful Motor and 4 Copper Nozzle.650w Electric HVIP Sprayer for House Painting,Furniture, Wall, Door.(NOT Battery)

Cordless Paint Sprayer for Dewalt 20V MAX Battery.Paint Spray Gun with Powerful Motor and 4 Copper Nozzle.650w Electric HVIP Sprayer for House Painting,Furniture, Wall, Door.(NOT Battery)

(5)
$74.99
FREE delivery Wed, Aug 20
50+ bought in past month
Loading...
Paint Sprayer Electric Spray Gun: 700W Spray Paint Gun with 1200ml Container, 4 Nozzles & 3 Patterns, Adjustable Air Flow, Easy Cleaning for House Painting, Furniture, Fence, Walls, Door (Red)

Paint Sprayer Electric Spray Gun: 700W Spray Paint Gun with 1200ml Container, 4 Nozzles & 3 Patterns, Adjustable Air Flow, Easy Cleaning for House Painting, Furniture, Fence, Walls, Door (Red)

(126)
$65.99
FREE delivery Wed, Aug 20
400+ bought in past month
Loading...
Paint Sprayer Electric Spray Gun: 700W Spray Paint Gun with 1200ml Container, 4 Nozzles & 3 Patterns, Adjustable Air Flow, Easy Cleaning for House Painting, Furniture, Fence, Walls, Door (Royal Blue)
Best Seller

Paint Sprayer Electric Spray Gun: 700W Spray Paint Gun with 1200ml Container, 4 Nozzles & 3 Patterns, Adjustable Air Flow, Easy Cleaning for House Painting, Furniture, Fence, Walls, Door (Royal Blue)

(97)
$69.99
PrimeFREE delivery Sat, Jun 14
Loading...
Paint Sprayer Electric Spray Gun: 700W Spray Paint Gun with 1200ml Container, 4 Nozzles & 3 Patterns, Adjustable Air Flow, Easy Cleaning for House Painting, Furniture, Fence, Walls, Door (Red)

Paint Sprayer Electric Spray Gun: 700W Spray Paint Gun with 1200ml Container, 4 Nozzles & 3 Patterns, Adjustable Air Flow, Easy Cleaning for House Painting, Furniture, Fence, Walls, Door (Red)

(126)
$65.99
FREE delivery Wed, Aug 20
400+ bought in past month
Loading...
Paint Sprayer Electric Spray Gun: 700W Spray Paint Gun with 1200ml Container, 4 Nozzles & 3 Patterns, Adjustable Air Flow, Easy Cleaning for House Painting, Furniture, Fence, Walls, Door (Royal Blue)
Best Seller

Paint Sprayer Electric Spray Gun: 700W Spray Paint Gun with 1200ml Container, 4 Nozzles & 3 Patterns, Adjustable Air Flow, Easy Cleaning for House Painting, Furniture, Fence, Walls, Door (Royal Blue)

(97)
$69.99
PrimeFREE delivery Sat, Jun 14
Loading...
Cordless Paint Sprayer for Dewalt 20V MAX Battery.Paint Spray Gun with Powerful Motor and 4 Copper Nozzle.650w Electric HVIP Sprayer for House Painting,Furniture, Wall, Door.(NOT Battery)

Cordless Paint Sprayer for Dewalt 20V MAX Battery.Paint Spray Gun with Powerful Motor and 4 Copper Nozzle.650w Electric HVIP Sprayer for House Painting,Furniture, Wall, Door.(NOT Battery)

(5)
$74.99
FREE delivery Wed, Aug 20
50+ bought in past month
Loading...
75 FT Garden Hose – 2025 Upgarded Expandable Garden Hose w/10 Pattern Spray Nozzle, 650psi Pure Brass 3/4” Fittings – Lightweight, Durable, and Kink-Free, Retractable Water Hoses for Gardening(Black)

75 FT Garden Hose – 2025 Upgarded Expandable Garden Hose w/10 Pattern Spray Nozzle, 650psi Pure Brass 3/4” Fittings – Lightweight, Durable, and Kink-Free, Retractable Water Hoses for Gardening(Black)

(62)
$31.95$29.00
FREE delivery Sat, Jun 28 on your first order
1K+ bought in past month
Loading...
100FT Garden Hose - 2025 New Version Expandable Garden Hose with 10 Function Spray Nozzle, 3/4" Brass Fittings and 4-Layer Latex Core, Lightweight, Durable, No-Kink Flexible Water Hoses (Black Gold)

100FT Garden Hose - 2025 New Version Expandable Garden Hose with 10 Function Spray Nozzle, 3/4" Brass Fittings and 4-Layer Latex Core, Lightweight, Durable, No-Kink Flexible Water Hoses (Black Gold)

(132)
$53.95
FREE delivery Sun, Jun 22
1K+ bought in past month
Loading...
GUKOK 50 FT Expandable Garden Hose, Water Hose with 10-Function High-Pressure Spray Nozzle, Heavy Duty Flexible Hose, 3/4" Solid Brass Fitting

GUKOK 50 FT Expandable Garden Hose, Water Hose with 10-Function High-Pressure Spray Nozzle, Heavy Duty Flexible Hose, 3/4" Solid Brass Fitting

(2,372)
$33.99$23.00
FREE delivery Sat, Jun 28 on your first order
1K+ bought in past month
Loading...
100 FT Garden Hose – 2025 Upgarded Expandable Garden Hose w/10 Pattern Spray Nozzle, 650psi Pure Brass 3/4” Fittings – Lightweight, Durable, and Kink-Free, Retractable Water Hoses for Gardening(Black)

100 FT Garden Hose – 2025 Upgarded Expandable Garden Hose w/10 Pattern Spray Nozzle, 650psi Pure Brass 3/4” Fittings – Lightweight, Durable, and Kink-Free, Retractable Water Hoses for Gardening(Black)

(51)
$45.95
FREE delivery Mon, Jun 23
2K+ bought in past month
Loading...
75 FT Garden Hose – 2025 Upgarded Expandable Garden Hose w/10 Pattern Spray Nozzle, 650psi Pure Brass 3/4” Fittings – Lightweight, Durable, and Kink-Free, Retractable Water Hoses for Gardening(Black)

75 FT Garden Hose – 2025 Upgarded Expandable Garden Hose w/10 Pattern Spray Nozzle, 650psi Pure Brass 3/4” Fittings – Lightweight, Durable, and Kink-Free, Retractable Water Hoses for Gardening(Black)

(62)
$31.95$29.00
FREE delivery Sat, Jun 28 on your first order
1K+ bought in past month
Loading...
100FT Garden Hose - 2025 New Version Expandable Garden Hose with 10 Function Spray Nozzle, 3/4" Brass Fittings and 4-Layer Latex Core, Lightweight, Durable, No-Kink Flexible Water Hoses (Black Gold)

100FT Garden Hose - 2025 New Version Expandable Garden Hose with 10 Function Spray Nozzle, 3/4" Brass Fittings and 4-Layer Latex Core, Lightweight, Durable, No-Kink Flexible Water Hoses (Black Gold)

(132)
$53.95
FREE delivery Sun, Jun 22
1K+ bought in past month
Loading...
GUKOK 50 FT Expandable Garden Hose, Water Hose with 10-Function High-Pressure Spray Nozzle, Heavy Duty Flexible Hose, 3/4" Solid Brass Fitting

GUKOK 50 FT Expandable Garden Hose, Water Hose with 10-Function High-Pressure Spray Nozzle, Heavy Duty Flexible Hose, 3/4" Solid Brass Fitting

(2,372)
$33.99$23.00
FREE delivery Sat, Jun 28 on your first order
1K+ bought in past month
Loading...
100 FT Garden Hose – 2025 Upgarded Expandable Garden Hose w/10 Pattern Spray Nozzle, 650psi Pure Brass 3/4” Fittings – Lightweight, Durable, and Kink-Free, Retractable Water Hoses for Gardening(Black)

100 FT Garden Hose – 2025 Upgarded Expandable Garden Hose w/10 Pattern Spray Nozzle, 650psi Pure Brass 3/4” Fittings – Lightweight, Durable, and Kink-Free, Retractable Water Hoses for Gardening(Black)

(51)
$45.95
FREE delivery Mon, Jun 23
2K+ bought in past month
Loading...
Frizzlife M3005 Replacement Filter Cartridge Set (4 Pack) for SK99,SP99,SK99 New and SP99 New Under Sink Water Filter System

Frizzlife M3005 Replacement Filter Cartridge Set (4 Pack) for SK99,SP99,SK99 New and SP99 New Under Sink Water Filter System

(1,648)
$69.99
FREE delivery Tue, Sep 23
200+ bought in past month