How to Add New Middleware Feature with Next.js 12.2 In Application - For Beginners
Hey everyone welcome back to daily tuition.
Released in October 2021 (Next.js 12.0) and has been in beta since then, Next.js Middleware is now stable. This release includes many breaking changes to the APIs.
In this lecture, we gonna talk about the changes that have been made with middleware.
You can start upgrading your Middleware usage today with the latest release (npm i next@latest).
Make sure you have the next 12.2 or later installed.
Previously, you could create a _middleware.ts file under the pages directory at any level. Middleware execution was based on the file path where it was created.
In the latest version,
You should declare one single Middleware file in your application, which should be located next to the pages directory and named without an _ prefix. Your Middleware file can still have either a .ts or .js extension.
Middleware will be invoked for every route in the app
Define a single Middleware file next to your pages folder
No need to prefix the file with an underscore
A custom matcher can be used to define matching routes using an exported config object
So let's understand how to use it.
If you want to learn next.js from the beginning here is the link:
Next.js Complete Course For Beginners
https://youtu.be/84CvqVTH9Y8
Tailwind CSS Complete Course
https://youtu.be/lZp4salRFFc
How to Make Blog Website with Next.js & Tailwind CSS - For Beginners
https://youtu.be/1T3GF6endl8
Javascript Complete Course
https://youtu.be/LlMCaEK9PLg
⏱️ Timestamps ⏱️
0:00 - Introduction
0:28 - Getting Started with Middleware
4:41 - Matcher
6:13 - Authentication
6:46 - Cookies
⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑
???? Support Me on Patreon ????:
https://www.patreon.com/dailytuition
???? Udemy Courses:
https://www.udemy.com/user/akshay-kashyap-6/
???? Playlist :
Complete MERN Series
https://youtube.com/playlist?list=PLynWqC6VC9KMJ7ffdoGM3LjnYlJPK4kiR
⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑
????️ Tools I use:
???? My Theme: https://www.youtube.com/watch?v=ekHlx6OdSvA
???? Font Family: https://fonts.google.com/specimen/Rubik?query=Rubik
⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑
???? Follow us:
????https://www.instagram.com/akki.2013/
More Videos:
???? Complete Node Course
https://youtu.be/-27HAh8c0YU
▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁
???? React Complete Tutorial
https://youtu.be/jWbzbq2C_RY
▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁
???? Complete Mobile Shopee E-Commerce Website Course - PHP & MySQL
https://youtu.be/KLWA2vCERSQ
▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁
???? Complete Portfolio Website with Bootstrap - HTML/CSS
https://youtu.be/dgKSqz3it50
▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁
???? Create a Shopping Cart Using PHP and Mysql
https://youtu.be/IO5ezsURqyg
▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁
???? Advanced Tic Tac Toe With HTML, CSS & JavaScript - For Beginners [2022]
https://youtu.be/kRQEkTHIEyU
▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁
???? Complete CRUD Operation with PHP MySql Database
https://youtu.be/JZdMXUIMdQw
▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁
???? Birthday Remainder Application with React - For Beginners
https://youtu.be/o2IZaojOz-o
▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁
???? Bootstrap Grid System The Complete Guide - In Action
https://youtu.be/hrKMGFkTKF8
Like this video If you find anything useful. Share with your friends that is all for now I will see you In the next one.
Thank You...! ????
⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑⋐⋑
Tags: #nextjs #howto #programming