NextJS Just Changed API Routing

preview_player
Показать описание
Get up to speed on how NextJS 13 with the App Router does API routing. A must know for folks writing React on NextJS.

#shorts
Рекомендации по теме
Комментарии
Автор

I love just return instead of res.send

dogik
Автор

I feel like it's worth noting that you don't have to use app/api, you can just have API routes anywhere that you want in the app dir

EthanStandel
Автор

Sweet can’t wait til I build a business around this architecture then they completely change it again in 2 years and also maybe start charging me for it!

over
Автор

I love having a function for each method, so much cleaner and it works a lot like express or something.

jackdavenport
Автор

I actually like this, it makes TypeScript a first-class citizen in the world of NextJS API routes finally. I was just handling NextJS API routes with TS the old fashioned pre-app router way yesterday and my God what a convoluted pita it was especially compared to this.

That said, still not even considering app router for anything serious until it’s stable and out of beta and I’ve done considerable prototyping.
“Bleed responsibly.” - Theo Browne

owenwexler
Автор

I used this for a react + vercel project and it’s working seamlessly 😄

Harshsepil
Автор

Concise, straight to the point, great, thank you.

qveygxl
Автор

You can get query params from the request. No need to create a URL object and extract from it like in the caveman days

_roj
Автор

That theme looks really nice! What's that one?

alexisalbertoza
Автор

FYI, I believe this is the same way /pages/api/ routes work if you enable the edge runtime.

DanCortes
Автор

Definitely prefer exporting functions over if/else

vikingthedude
Автор

yeah..i was working on that this week and i love it❤

egretfx
Автор

One clarification: it doesn't need to be in the /app/API directory-- you can do a route handler anywhere that you name a file route.ts!

zombiefacesupreme
Автор

How many things we should learn?? I'm very confused!!! Every 6 months, a new thing pops up!!

kashmirtechtv
Автор

Great video! I have concerns about this in case of DX, especially in IDEs. Reading all api dirs structure with route.ts inside might not be that easy to do so, Ctrl + P to search files across workspace won’t be faster either

CoJestSynu
Автор

I am sending a request with form-data where I am sending an image. Please can anyone tell me how I can access files to upload in new api routes.(Showed in this video)

abdullahawan
Автор

this is a better way for routting than react router

abner
Автор

Hello thanks for the video.
I have question can we use next js rest api with flutter ?

gamescope
Автор

this doesn't solve the problem next had with the old way of doing APIs, which is WebSockets, it was already hard to set them up before Next 13( idk how hard it is to do that now), but with express for example it's pretty straightforward.

yassinesafraoui
Автор

Could you please share the vs code theme and fonts you are using, it looks very good

rakeshchandradash