API Routes with Next.js 14 - Course part 10

Поділитися
Вставка
  • Опубліковано 4 жов 2024
  • Get access to my private courses 👉 dub.link/devco...
    Thanks for watching! Please subscribe ❤️
    Guillaume
    👇
    Read my adventures
    👉 dub.link/newsl...
    Join my Discord
    👉 dub.link/discord
    Book a coaching
    👉 dub.link/guill...
    Looking for a repository?
    👉 dub.link/repos
    Visit my website
    👉 dub.link/codew...
    Install my package UserItem
    👉 dub.link/useritem
    💥 TOP VIDEOS
    Learn Nuxt
    👉 dub.link/nuxt
    Learn Nextjs
    👉 dub.link/next
    Learn Supabase
    👉 dub.link/supabase
    ⚙️
    • Theme that I use: VSCode Dark
    • VSCode Icons package: miguelsolorio.symbols
    • Snippets: my own, coming soon :)
    Thank you :)
    Guillaume

КОМЕНТАРІ • 84

  • @AmodeusR
    @AmodeusR 6 місяців тому +11

    Thanks, this video helped me a lot. Not even the official NextJS focumentation had a proper explanation of how to make routes and such.

  • @sarhan_104
    @sarhan_104 9 місяців тому +19

    Explained more in 9 minutes than 4 hours big project video,
    thanks a lot guillaume

  • @LyleLundy
    @LyleLundy 6 місяців тому +5

    Very helpful, thanks! The official Next docs are a lot to read through. So this is very helpful to have it in quick video format. Very knowledge packed video!

  • @codewithguillaume
    @codewithguillaume  Рік тому +7

    Quick note: I've made a mistake, method is not in header but over header in fetch call 🚀

  • @ansarqazi4377
    @ansarqazi4377 4 місяці тому +2

    Hey, thanks mate. I've been finding the solution to some error related to API routes & your video literally solved it for me. Thanks a lot. Stay blessed! Highly appreciate your work!

  • @codewithguillaume
    @codewithguillaume  10 місяців тому +9

    For QUERIES:
    async function GET(req:NextRequest){
    console.log(req.nextUrl.serachParams.get("keyword"))
    }

  • @Devin-tf1es
    @Devin-tf1es 3 місяці тому +1

    Thank you so much, I felt like I was going insane trying trying to figure out nextjs' api routes.
    The first main problem was realizing that you have to name each file for folder-based routes, as route.ts | js

  • @WinchesterD
    @WinchesterD 5 місяців тому +2

    Thanks for the explanation. It's strange that right now, in official documentation API routes are covered only for "pages router", nothing said about App router, but however, you did well showing good use cases.

  • @badis6717
    @badis6717 Рік тому +7

    This is extremely accurate!
    I didn't find any simple short video that explains rest api in next js, and here we are i found your video and its also new.
    I thanks you alot ❤
    I recommend creating a video or playlist where you explain how to make full rest api with crud, images, files, auth and db

    • @badis6717
      @badis6717 Рік тому

      Or you know , don't use db or external packages, instead use json files
      So that it remain a next next tutorial xD

    • @codewithguillaume
      @codewithguillaume  Рік тому

      Everything inside Next.js 13 or with another backend framework? 🥰 thanks for comments my friend

    • @badis6717
      @badis6717 Рік тому

      @codewithguillaume next.js 13, in the style of this great video, but more full

  • @NickTub3
    @NickTub3 4 місяці тому +1

    Thank you so much!! A few minutes of my time watching this solved hours worth of troubleshooting.

    • @codewithguillaume
      @codewithguillaume  4 місяці тому

      Thanks my friend ! Checkout my masterclass coming soon

  • @GamingWithLag
    @GamingWithLag 24 дні тому

    Thanks for the video. I did not find the context thing anywhere else which I needed

  • @anthonyfarias321
    @anthonyfarias321 9 місяців тому +17

    The current docs does not explain this, they explain something that does not work. Use handlers

  • @PetriikVx
    @PetriikVx 10 місяців тому +2

    Thanks so much Guillaume, after hours of searching, this video solved my problem!

  • @jdm4657
    @jdm4657 7 місяців тому +1

    EXCELLENT video. It finally is starting to make sense to me. Next time do a video with Prisma so I can follow

  • @johnmuku1773
    @johnmuku1773 3 місяці тому +1

    Thanks for this. This helped more than the docs

  • @atejap
    @atejap 8 місяців тому +2

    Please, keep doing this great king of job. Tks

  • @MertMusaTemel
    @MertMusaTemel 2 місяці тому +2

    Thanks a lot mate, very informative and you get a new subscriber

  • @lrnngman2942
    @lrnngman2942 11 місяців тому +4

    Bro your teaching skill is amazing even I don't understand English

  • @georgesmaroun1406
    @georgesmaroun1406 9 місяців тому +3

    Excellente video Guillaume! Merci!

  • @clasicalsingingfans8808
    @clasicalsingingfans8808 5 місяців тому

    that one video talks no BS straight to the point. Thanks, Subscribed you!

  • @jeremy0x
    @jeremy0x Місяць тому

    This was super helpful. Thanks Guillaume! Great video ✨

  • @efratywestchester9291
    @efratywestchester9291 Місяць тому

    thank you, finally someone who explains well!!!

  • @JohnKimani-d6z
    @JohnKimani-d6z 2 місяці тому

    Very clear explanation. Had to subscribe.

  • @zyx8463
    @zyx8463 7 місяців тому +2

    thanks this video helped a lot

  • @VishalSingh-ls4re
    @VishalSingh-ls4re 2 місяці тому +1

    "That's what i'm looking for. Thanks ."

  • @elhadi9886
    @elhadi9886 5 місяців тому +1

    very well explained and helpful, Thanx bro

  • @tamerahmed9860
    @tamerahmed9860 7 місяців тому +1

    Thank you! clear explantion as always

  • @muthupandideivamsanmugam1774
    @muthupandideivamsanmugam1774 5 місяців тому +1

    thankyou for teaching sir

  • @lorddesert
    @lorddesert 9 місяців тому +2

    Simple and straight to the point. Love it. Thank you so much!

  • @ssojyeti2
    @ssojyeti2 5 місяців тому

    Great, concise explanation thanks!

  • @TahaECHCHOUAL
    @TahaECHCHOUAL 6 місяців тому +2

    thanks

  • @edutechpty
    @edutechpty 7 місяців тому +1

    Thanks a lot!

  • @unnamedcodes
    @unnamedcodes 3 місяці тому

    You just got yourself a new subscriber. ❤

  • @AndresMartinez-se9zl
    @AndresMartinez-se9zl 2 місяці тому

    Hey, what is the difference between api routes and route handlers and which one might you use in next js 14?

  • @UAng-ro9kt
    @UAng-ro9kt 10 місяців тому +1

    Thanks for sharing, very helpful

  • @LorraineCai
    @LorraineCai 4 місяці тому

    Thanks!! You saved my life!!!

  • @itsRahul-dd4xm
    @itsRahul-dd4xm 2 місяці тому +1

    Thankyou bro

  • @toomanyarguments
    @toomanyarguments 8 місяців тому +3

    With server-actions, do we still need api routes?

  • @sergiohidalgorobles8351
    @sergiohidalgorobles8351 9 місяців тому +1

    just that I was looking

  • @webmandman
    @webmandman 8 місяців тому +1

    can you explain export const dynamic = 'force-dynamic'; and the build process. from what I found out today that route will be prerendered in the build process because its a static route. I had to use the 'force-dynamic' const to make it a dynamic rooute.
    ofcourse now I'm searching the web to figure out why my response in production is an old version. in localhost:3000 if i update my sql query to pull different data, the route response will reflect that updated data, but not in production. kinda frustrating its not working like a traditional PHP request.

  • @techjdx
    @techjdx 12 днів тому

    Thanks you .

  • @maxkosh4839
    @maxkosh4839 7 днів тому +1

    just one question: why? Why do we need this API if we can do like anything in server components?

    • @codewithguillaume
      @codewithguillaume  7 днів тому +1

      Server components / API are 2 différents approaches. Depends on how you want to architecture your project !

  • @haraldlons
    @haraldlons 7 місяців тому +1

    Really good video!

  • @fre6090
    @fre6090 8 місяців тому +1

    how would I write unit tests for a function like this?

  • @xmaxfuture
    @xmaxfuture 7 місяців тому +1

    great tut

  • @ionutcirja7121
    @ionutcirja7121 8 місяців тому +1

    Does next have any type for context? I'm talking about the api context. Couldn't find anything in their docs. Thanks

    • @codewithguillaume
      @codewithguillaume  8 місяців тому

      Good question probably ask on Twitter on Nextjs community

  • @coinz_yt
    @coinz_yt 4 місяці тому +2

    Hello can you tell me which theme you're using in your vscode?
    thanks!

  • @manassesraimundo
    @manassesraimundo Місяць тому +1

    how to create an API with JWT authentication in Nextjs

  • @djchoodaofficial
    @djchoodaofficial 8 місяців тому +1

    In case when we need to get only one user by params(id), you fetch all users and then find selected user. Is this good because we can have more than 1000 users and our performance would be bad if we fetch that number of users.Maybe is better with RESP API to filter call to backend and get only that user

    • @codewithguillaume
      @codewithguillaume  8 місяців тому

      Yep you can do this. This was just an example here

  • @PeriklesPeriklesoglu
    @PeriklesPeriklesoglu 6 місяців тому

    thank you

  • @abe6615
    @abe6615 22 дні тому

    What is the site he's using to monitor the api data?

  • @arvindknit31
    @arvindknit31 2 місяці тому

    Hi dear, can you please tell me which AI tool you are using?

  • @AlessiaCaraFans
    @AlessiaCaraFans 2 місяці тому

    how do you call async await inside client compoenent i thought it s not possible , only if it s a server component ?

  • @dominikyszkowski7663
    @dominikyszkowski7663 7 місяців тому

    How to use this api route inside the nextjs app. for example im on page.tsx and i want under click button call post method ?

  • @patrikmeijer7437
    @patrikmeijer7437 Місяць тому +1

    Thanks for mentioning that the file has to be named route.ts...

  • @alisalami1644
    @alisalami1644 7 місяців тому

    i love you u save me

  • @AbuBakr1
    @AbuBakr1 5 місяців тому

    How do i implement API authentication? Sending request from postman for protected route

  • @SalmanIqbal-kr8mh
    @SalmanIqbal-kr8mh 12 днів тому

    Dear Sir you fetch external api can you make small video that create custom api in api folder and fetch internal api and show in browser just 3 or 4 items fetch i tried alot of videos everyone fetching external apis only 1 youtuber create custom api and fetch internal api but i donot understand can you make?

  • @감기여요
    @감기여요 10 місяців тому +1

    What if I use js instead of react?

  • @adammuhtarif
    @adammuhtarif 5 місяців тому

    When i depoloy the app it's a problem of cors