silverwolf-x's picture
|
download
raw
1.25 kB
# API routes with REST
Next.js ships with [API routes](https://github.com/vercel/next.js#api-routes), which provide an easy solution to build your own `API`. This example shows how it can be used to create your [REST](https://en.wikipedia.org/wiki/Representational_state_transfer) `API`.
## Deploy your own
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/vercel/next.js/tree/canary/examples/api-routes-rest&project-name=api-routes-rest&repository-name=api-routes-rest)
## How to use
Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example:
```bash
npx create-next-app --example api-routes-rest api-routes-rest-app
```
```bash
yarn create next-app --example api-routes-rest api-routes-rest-app
```
```bash
pnpm create next-app --example api-routes-rest api-routes-rest-app
```
### Deploy to Vercel
Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).

Xet Storage Details

Size:
1.25 kB
·
Xet hash:
adc1518156c456cafe9c7f94309b99338dbf4ae8b0a402bd95348d044c72bd9d

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.