Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kanokpit-yowaratch/nextjs-api-routes

Creating API Routes in Next.js
https://github.com/kanokpit-yowaratch/nextjs-api-routes

Last synced: about 1 month ago
JSON representation

Creating API Routes in Next.js

Awesome Lists containing this project

README

        

## Next.js API Routes

The examples in this project demonstrate how to create different types of APIs in Next.js.

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

## Main point

Next.js can create API routes in 2 places:
1. In app directory
2. In pages directory

There are at least four differences between the 2 methods:
1. Folder placement and File naming
2. Function name
3. Request
4. Response

And more: Integration with cookies [readmore](https://suaipisuai.com/post/nextjs-api-routes)