Next.js middleware is best place to add logging to your Next js application. Middleware runs before each request and is run as edge function. In this video you will learn how to save data to Redis database with Next.js edge functions by building a request logger middleware.
Check out Upstash: https://bit.ly/UPSTASH
Request logger repo: https://github.com/tumetus/nextjs-request-logger
Learn Programming (Skillshare FREE trial): https://skl.sh/3cYxUP5
My courses:
React basics: https://skl.sh/2XAKn7u
HTML & CSS for beginners: https://skl.sh/34wvGUH
Draft.js basics: https://skl.sh/3cJ5Hw4
Connect with me:
Website: https://tuomokankaanpaa.com
My newsletter: https://tuomokankaanpaa.com/newsletter
Twitter: https://twitter.com/tumee
Skillshare: https://www.skillshare.com/r/user/tume
Timestamps
00:00 What this video is about
00:46 Steps we take
01:39 Creating the middleware
03:28 Logging the data
05:42 Upstash Redis
06:52 Setting up Redis database
08:39 Connecting Next.js app to Redis
10:27 Saving data to Redis with REST api
15:01 Viewing log entries
16:27 Fetching data from Redis database
#nextjs #middleware #redis
Comments