NextJS Just Changed API Routing

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
there's a new way of doing API routes in xjs13 with the app directory check it out it's really cool first off there's a change in where the code goes it no longer goes in Pages slash API and then the route name now it goes in either app or Source then in an API directory then in a route directory so in this case for example the test directory and then within that route.ts or JS if you prefer and then you export functions for the various verbs for example get and then you use nextresponse.json to return a Json payload query parameters are a bit more difficult now you got to use the URL to parse that URL and then get one of the search parameters for yourself handling a post is pretty easy too all you need to do is await the Json for the request body and then you can parse it as normal and return a Json payload these are some solid improvements the way that we handle apis in next so I'm really happy to see it
Info
Channel: Jack Herrington
Views: 57,664
Rating: undefined out of 5
Keywords: next 13, nextjs 13, next.js 13, next js 13, nextjs react 18, mui nextjs, vite nextjs, next, nextjs, next js, next.js, nextjs react, nextjs typescript, nextjs api, next js typescript, nextjs npm, react 18, react router v6, vite, react, reactjs, react.js, react app, v6 engine, typescript, react typescript, react hook, web development, nextjs performance, astro, astro 2
Id: 7x3p5F0TgUA
Channel Id: undefined
Length: 0min 51sec (51 seconds)
Published: Wed Mar 29 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.