rsnext/examples/api-routes-cors
Tanmay Laud f00ad581a1
Added .gitignore to examples that are deployed to vercel (#15127)
Co-authored-by: Joe Haddad <joe.haddad@zeit.co>
2020-07-16 10:52:23 -04:00
..
lib Upgrade to Prettier 2 (#13061) 2020-05-18 15:24:37 -04:00
pages Add cors example and update API routes docs (#12390) 2020-05-02 00:06:23 -04:00
.gitignore Added .gitignore to examples that are deployed to vercel (#15127) 2020-07-16 10:52:23 -04:00
package.json Add cors example and update API routes docs (#12390) 2020-05-02 00:06:23 -04:00
README.md Suggest npx over npm init (#13637) 2020-06-01 17:36:57 +00:00

API Routes Example with CORS

Next.js ships with API routes which provides an easy solution to build your own API.

This example shows how to create an API endpoint with CORS headers, using the cors package.

Deploy your own

Deploy the example using Vercel:

Deploy with Vercel

How to use

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

npx create-next-app --example api-routes-cors api-routes-cors-app
# or
yarn create next-app --example api-routes-cors api-routes-cors-app

Deploy it to the cloud with Vercel (Documentation).