NextJS 13: REST APIs Made Simple

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Nash as 13's new route Handler functionality in its app writer makes building rest apis super simple so I want to create a Pokemon rest API first we create a Pokemon folder in our source app directory and then we create a route.ts file within that that's going to handle any requests that go to the slash Pokemon route to return a list of all our Pokemon we respond to the get verb by simply returning a Json payload of all of our Pokemon our exported post function adds a Pokemon to the list first it awaits the Json body and then it returns a Json response that has the new ID of the database Center that we've created to handle Pokemon one we create a nested directory called brackets ID and all the exposed route handling functions in that route TS file get that ID as the params in the second argument of the function when they're called in this case get does a Json response with just that Pokemon you define the delete function to delete an entity the put function to update an entity and the patch function if you want to to incrementally update an entity it's pretty easy to make a rest API in xjs13's new app router
Info
Channel: Jack Herrington
Views: 86,699
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, react typescript, json, rest api, rest, google api, chatgpt api, web api, open api, gpt api, api gateway, api example, json api, chat api, nextjs api router, api router, next api router
Id: RXuOyR3yscM
Channel Id: undefined
Length: 0min 59sec (59 seconds)
Published: Tue Apr 04 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.