Create Next.js Request Logger (middleware, edge functions, redis)

Sdílet
Vložit
  • čas přidán 16. 07. 2024
  • 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: bit.ly/UPSTASH
    Request logger repo: github.com/tumetus/nextjs-req...
    Learn Programming (Skillshare FREE trial): skl.sh/3cYxUP5
    My courses:
    React basics: skl.sh/2XAKn7u
    HTML & CSS for beginners: skl.sh/34wvGUH
    Draft.js basics: skl.sh/3cJ5Hw4
    Connect with me:
    Website: tuomokankaanpaa.com
    My newsletter: tuomokankaanpaa.com/newsletter
    Twitter: / tumee
    Skillshare: 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
  • Věda a technologie

Komentáře • 17

  • @RYeah100
    @RYeah100 Před rokem +1

    Tuomo great video and I was looking for this solution. I also liked the whole video structure and walkthrough of what exactly you are doing. Subscribed. Keep it up with the videos.

  • @mattoattacko
    @mattoattacko Před 2 lety

    Very intereesting video!

  • @hbela1000
    @hbela1000 Před rokem

    very good, thx.

  • @skmanjuralam7099
    @skmanjuralam7099 Před 4 měsíci

    Great tutorial

  • @yarapolana
    @yarapolana Před měsícem

    Kiitos for the video🎉

  • @RanjeetYadav-bn1fd
    @RanjeetYadav-bn1fd Před 3 měsíci

    I want to connect Redis in the middleware without using uptash/redis. I want to use regular Redis connect process

  • @backyardmayhemusa
    @backyardmayhemusa Před rokem

    Great tutorial. However how do you log the request body? I keep getting null even when i print to console? Same with the response body

  • @skmanjuralam7099
    @skmanjuralam7099 Před 3 měsíci

    Is it possible to connect normal Redis through middleware??? As I don't want to use upstash.

  • @iheckinloveurmom
    @iheckinloveurmom Před 10 měsíci

    thanks, regard from berotot

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Před 10 měsíci

      Cheers!

    • @iheckinloveurmom
      @iheckinloveurmom Před 10 měsíci

      @@TuomoKankaanpaa i'm really thankful man, thank you again. ur video is so helpful.
      did you know berotot by any chance?

    • @TuomoKankaanpaa
      @TuomoKankaanpaa  Před 10 měsíci

      I’m super glad to hear that! I do not know unfortunately