Excellent tutorial! I've watched several videos about both Next JS APIs, and server requests in general. This one is by far the best I've seen for both topics.
Thank you so much, you saved me from alot of stress after goin through the documentations, copilot and chatgpt couldnt solve the issue until i stomped on your channel
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!
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!
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
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.
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
OK but how do you call the API request in production once you build to Vercel? I just get a HTML response saying Authentication Required. How do you authenticate an API call from Postman to a Next app?
Took a whole next.js bootcamp. Never once was mentioned that the api folder works like this. Like its an active running server. Thats why my app was not building cause i just treated it as functions to fetch data from servers.
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.
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
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?
Thanks, this video helped me a lot. Not even the official NextJS focumentation had a proper explanation of how to make routes and such.
Quick note: I've made a mistake, method is not in header but over header in fetch call 🚀
Excellent tutorial! I've watched several videos about both Next JS APIs, and server requests in general. This one is by far the best I've seen for both topics.
For QUERIES:
async function GET(req:NextRequest){
console.log(req.nextUrl.serachParams.get("keyword"))
}
you've earned a sub mate. I've been so scared of all this postman and api stuff. you made it super simple
Thank you so much, you saved me from alot of stress after goin through the documentations, copilot and chatgpt couldnt solve the issue until i stomped on your channel
Explained more in 9 minutes than 4 hours big project video,
thanks a lot guillaume
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!
Thanks my friend ! I’ll keep improving
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!
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
Nice !
Thank you so much!! A few minutes of my time watching this solved hours worth of troubleshooting.
Thanks my friend ! Checkout my masterclass coming soon
Thanks so much Guillaume, after hours of searching, this video solved my problem!
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.
This was super helpful. Thanks Guillaume! Great video ✨
that one video talks no BS straight to the point. Thanks, Subscribed you!
Bro your teaching skill is amazing even I don't understand English
Thanks bro! See you soon and subscribe if you didn’t yet !
Vraiment
Thanks a lot mate, very informative and you get a new subscriber
Thanks man!
EXCELLENT video. It finally is starting to make sense to me. Next time do a video with Prisma so I can follow
Excellente video Guillaume! Merci!
👍😉
Thanks for this. This helped more than the docs
Nope my friend
Please, keep doing this great king of job. Tks
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
Or you know , don't use db or external packages, instead use json files
So that it remain a next next tutorial xD
Everything inside Next.js 13 or with another backend framework? 🥰 thanks for comments my friend
@codewithguillaume next.js 13, in the style of this great video, but more full
thank you, finally someone who explains well!!!
how do you call async await inside client compoenent i thought it s not possible , only if it s a server component ?
Very clear explanation. Had to subscribe.
Thanks for the video. I did not find the context thing anywhere else which I needed
With server-actions, do we still need api routes?
You just got yourself a new subscriber. ❤
Welcome my friend 🙌
how would I write unit tests for a function like this?
OK but how do you call the API request in production once you build to Vercel? I just get a HTML response saying Authentication Required. How do you authenticate an API call from Postman to a Next app?
Hey, what is the difference between api routes and route handlers and which one might you use in next js 14?
Took a whole next.js bootcamp. Never once was mentioned that the api folder works like this. Like its an active running server. Thats why my app was not building cause i just treated it as functions to fetch data from servers.
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.
Thanks! I wish I found this a little earlier lol. It is difficult finding good examples on v14, especially with dynamic routes.
Thank you! clear explantion as always
Thanks my friend
just one question: why? Why do we need this API if we can do like anything in server components?
Server components / API are 2 différents approaches. Depends on how you want to architecture your project !
Does next have any type for context? I'm talking about the api context. Couldn't find anything in their docs. Thanks
Good question probably ask on Twitter on Nextjs community
What is the site he's using to monitor the api data?
thanks this video helped a lot
very well explained and helpful, Thanx bro
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
Yep you can do this. This was just an example here
Really good video!
Thanks my friend it means a lot
Great, concise explanation thanks!
Hi dear, can you please tell me which AI tool you are using?
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 ?
Thanks!! You saved my life!!!
Why is localhost:3000/api can access pages/api/route.ts? I thought it would be localhost:3000/api/route. Sorry Im confused.
How do i implement API authentication? Sending request from postman for protected route
how to create an API with JWT authentication in Nextjs
Thanks a lot!
When i depoloy the app it's a problem of cors
What if I use js instead of react?
You can !
The current docs does not explain this, they explain something that does not work. Use handlers
True they should update it
Thanks for sharing, very helpful
thankyou for teaching sir
great tut
Thanks my friend
Simple and straight to the point. Love it. Thank you so much!
"That's what i'm looking for. Thanks ."
Well and clear.
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?
Thankyou bro
thanks
Thanks you .
thank you
Enjoy my friend !
just that I was looking
i love you u save me
Thanks for mentioning that the file has to be named route.ts...
No problem man