The Ultimate Guide To Next.js Route Handlers - CRUD

Sdílet
Vložit
  • čas přidán 3. 07. 2024
  • GitHub Repo 👇
    github.com/bwestwood11/route-...
    Learn how to use the POST, GET, PATCH & DELETE HTTP Methods inside of Next.js 13's app directory.
    This will allow you to create a fully functional CRUD operational application.
    Route Handlers can be confusing but this video will teach you how to use dynamic data, useSearchParams, HTTP Methods, fetch web API, and more.
    Join my FREE Discord to talk and network about web development! 👇
    / discord
    Time Stamps
    0:00 Intro & Demo
    1:58 Go Over the Next.js Docs
    4:04 Create a new Next.js 13 Application
    6:55 Setup Prisma ORM and MongoDB
    15:52 POST Request
    29:23 GET Request
    44:46 PATCH/PUT Request
    1:07:03 DELETE Request
    1:14:20 Outro

Komentáře • 42

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

    THIS VIDEO IS FANTASTIC, I'VE LITERALLY SPENT DAYS TRYING TO FIGURE THIS OUT THEN BUMPED INTO THIS VID, COVERS EVERYTHING EXACTLY AS I NEEDED
    YOU DESERVE A BEER ON MY TAB

  • @fakn9159
    @fakn9159 Před 7 měsíci +3

    Exactly what is needed. A full rundown of everything important with real examples. Great!

  • @FendiFliperachi
    @FendiFliperachi Před 9 měsíci +4

    Just what I was looking for! And finally someone who doesn’t do “User Posts” or “Todos” as examples

    • @brettwestwooddeveloper
      @brettwestwooddeveloper  Před 9 měsíci +1

      Yea I have seen a lot of those, same concept though. Thanks for checking out my video!

  • @shumit
    @shumit Před 9 měsíci

    Thank you very much for covering the PATCH and DELETE methods !! They are hardly found on YT. Thanks again !!

  • @kalel19x
    @kalel19x Před 9 měsíci +2

    Great video @brettwestwooddeveloper, doing a NextJS13 project and I'm basically using most of your tutorials as a backbone for our project and it's helping tons. Thank you!

  • @sayednaweed745
    @sayednaweed745 Před 9 měsíci

    Great explanation.
    Thank you.

  • @harsinghsekhon5935
    @harsinghsekhon5935 Před 7 měsíci +1

    Thanks Again Brett!

  • @enechukwuchibuike7234
    @enechukwuchibuike7234 Před 16 dny +1

    Amazing Tutorial.
    Thank you.

  • @prashlovessamosa
    @prashlovessamosa Před 9 měsíci +1

    I was searching for this
    Your notification
    Thanks man

  • @kaltube4817
    @kaltube4817 Před 4 měsíci +1

    Well Done Brother..

  • @johndeer8405
    @johndeer8405 Před 9 měsíci

    Grateful as always! Was wondering if you can do a quick vid on how to display unique user data in dashboard other than session data. For example, products/services that a unique seller has created and orders associated with said products/services. Thanks again

  • @alexdin1565
    @alexdin1565 Před 6 měsíci

    thanks for this amazing tutorial please can you do a video about pagination

  • @daniyalfarooq998
    @daniyalfarooq998 Před 9 měsíci

    Great video! You made a video about custom keys in user object using JWT. Can you show us how can we synchronize credentials and google provider accounts of users using jwt token so that an email can only be used in a google or credentials user account at a time and also have custom keys in user object ( in google provider account too ) other name , email , image? BTW your content is most straight forward and logical out there on youtube. Thanks :)

  • @FarazFKhan
    @FarazFKhan Před 9 měsíci

    At the very end, if you've set the new state for books via setBooks, why is the return elements of the page not rerendering? Why is a window reload required separately?

  • @joseernestoroldan
    @joseernestoroldan Před 6 měsíci

    Hello! Really awesome tutorial! I understood everything, very well explained. I just wanted to know if it would be possible to have also delete method inside the edit route.

    • @joseernestoroldan
      @joseernestoroldan Před 6 měsíci

      I meant... can you do a route.ts file for both methods, patch and delete?

  • @ayushkathariya
    @ayushkathariya Před 9 měsíci

    I am using next auth to protect my api route handlers and i am using Google oauth strategy. But when I send fetch request from server components i get unauthorized but when i send same request from client component i got the result . Why is this happening?

  • @destocot1729
    @destocot1729 Před 9 měsíci +1

    great video, why do you filter the books if the page gets reloaded anyways? after the delete request

    • @brettwestwooddeveloper
      @brettwestwooddeveloper  Před 9 měsíci +1

      technically I think you are right. If the page reloads you shouldn't have to filter it. Good catch!

  • @oketunbiolufunke1142
    @oketunbiolufunke1142 Před 7 měsíci +1

    I keep getting a 500 status code(internal server error)when either posting or getting data from the db
    And can’t really figure out where the issue is from

  • @aguud
    @aguud Před 6 měsíci

    how to display the old value of the book inside the input form when editing?

    • @aguud
      @aguud Před 6 měsíci

      I've found a way, add setTitle(data.title); setDate(data.date); under setBook(data)

  • @owl3379
    @owl3379 Před 9 měsíci +2

    You should ddo the same also for server actions :)

  • @mrspecial3170
    @mrspecial3170 Před 9 měsíci +2

    What is really confused me is the typescript.. i prefer the jsx.

    • @brettwestwooddeveloper
      @brettwestwooddeveloper  Před 9 měsíci +4

      typescript is worth doing, I say just jump in and if you get stuck as chat gpt or overflow stack

    • @mrspecial3170
      @mrspecial3170 Před 9 měsíci +2

      @@brettwestwooddeveloper the reason why I find it difficult. It because I never give it a try ..

    • @brettwestwooddeveloper
      @brettwestwooddeveloper  Před 9 měsíci

      try it@@mrspecial3170

  • @prashlovessamosa
    @prashlovessamosa Před 8 měsíci +2

    Forgot your password 😅 haven't uploaded any stuff.

  • @bitkillerjones
    @bitkillerjones Před 9 měsíci +2

    i know this is minor but its prisma not prism

    • @brettwestwooddeveloper
      @brettwestwooddeveloper  Před 9 měsíci

      I know its Prisma, probably just my accent lol

    • @bitkillerjones
      @bitkillerjones Před 9 měsíci +1

      @@brettwestwooddeveloper Your videos are very helpful!
      Would love to see a bigger project tutorial using Next.js 13. Keep it up

  • @JRichens
    @JRichens Před 9 měsíci

    Thank you - followed the entire video though. My only thought... window.location.reload() seems a really clunky way to reload using Next !?! What is the alternative, as when I remove it, it has another book ticked when setBooks(books.filter((book: Book) => book.id !== data.id))