From the course: Master Next.js: Elaborate Hands-On Web Development, React Basics, Advanced Next.js, and Deployment

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

API routes with Next.js

API routes with Next.js

With Next.js, you actually have some built-in functionality to do API routes. And basically, an API route is a way to create serverless endpoints. So you don't need to have a server, but if you want to access, like, handle HTTP requests, those routes are meant to handle server-side logic. So for serverless deployments like Versal or AWS Lambda, what happens is, if you're running with AWS, they're going to leverage the underlying serverless infrastructure to provide you which is a very convenient and clean way to build server-side logic. Generally, people know AWS. Let's say you want to create an API endpoint. You could really do so by just creating a function that's like a handler, like you would with Express, that would have request and response. I have a full course on Express and Node if you're curious and learning more about CRUD. And I always think it's good to kind of learn about that stuff, even though the whole point here is you don't need that. You don't need to create your…

Contents