rsnext/examples/api-routes
Tim Neutkens 483bd3ddda
Rename ZEIT to Vercel (#12075)
* Find/replace

* Update more URLs

* More rename

* Fix remaining examples

* More updates

* Update create-next-app

* Update remaining text

* Update

Co-authored-by: Shu Uesugi <shu@chibicode.com>
2020-04-21 11:47:12 +02:00
..
components feat: update api-routes example to SSG (#11019) 2020-03-12 17:55:24 -05:00
pages [Examples] Add SWR to api-routes and api-routes-middleware (#11385) 2020-04-07 09:49:59 -04:00
data.js Improve linting rules to catch more errors (#9374) 2019-11-10 19:24:53 -08:00
package.json [Examples] Add SWR to api-routes and api-routes-middleware (#11385) 2020-04-07 09:49:59 -04:00
README.md Rename ZEIT to Vercel (#12075) 2020-04-21 11:47:12 +02:00

Basic API routes example

Next.js ships with API routes which provides an easy solution to build your own API. This example shows how to create multiple API endpoints with serverless functions, which can execute independently.

Deploy your own

Deploy the example using Vercel:

Deploy with Vercel

How to use

Using create-next-app

Execute create-next-app with npm or Yarn to bootstrap the example:

npm init next-app --example api-routes api-routes-app
# or
yarn create next-app --example api-routes api-routes-app

Download manually

Download the example:

curl https://codeload.github.com/zeit/next.js/tar.gz/canary | tar -xz --strip=2 next.js-canary/examples/api-routes
cd api-routes

Install it and run:

npm install
npm run dev
# or
yarn
yarn dev

Deploy it to the cloud with Vercel (Documentation).