API Routes

In this lesson, we will learn how to create and consume an API in the same Next.js app.

Before moving forward, learn more about Fetching Data for Pages, we'll be fetching API routes inside our pages.

We'll create a simple API which returns a list of famous quotes, and gets rendered on our Next.js app. The finished app will look like this:

Let's get started.