Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/kanokpit-yowaratch/nextjs-api-routes
- Owner: kanokpit-yowaratch
- Created: 2024-11-02T23:19:06.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2024-11-03T15:44:49.000Z (about 2 months ago)
- Last Synced: 2024-11-03T16:29:55.918Z (about 2 months ago)
- Language: TypeScript
- Size: 186 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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 directoryThere are at least four differences between the 2 methods:
1. Folder placement and File naming
2. Function name
3. Request
4. ResponseAnd more: Integration with cookies [readmore](https://suaipisuai.com/post/nextjs-api-routes)