rsnext/examples/api-routes-cors
Michael Novotny fe797c1074
Updates Mozilla links to not include language preference (#55326)
Internal suggestion to remove `en-US` from Mozilla urls since MDN is
available in multiple languages nowadays it will automatically redirect
to the viewer’s language preference.

Closes
[DX-2076](https://linear.app/vercel/issue/DX-2076/make-external-mozilla-links-language-agnostic-in-nextjs-docs)
2023-09-13 11:06:29 -05:00
..
pages chore(examples): Convert api-routes-cors example to TypeScript (#38356) 2022-07-06 13:12:40 +00:00
.gitignore Remove incorrect entries for pnpm debug log (#47241) 2023-03-26 22:26:05 -07:00
next-env.d.ts Remove incorrect entries for pnpm debug log (#47241) 2023-03-26 22:26:05 -07:00
package.json chore(examples): Convert api-routes-cors example to TypeScript (#38356) 2022-07-06 13:12:40 +00:00
README.md Updates Mozilla links to not include language preference (#55326) 2023-09-13 11:06:29 -05:00
tsconfig.json chore(examples): Convert api-routes-cors example to TypeScript (#38356) 2022-07-06 13:12:40 +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 or preview live with StackBlitz

Deploy with Vercel

How to use

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

npx create-next-app --example api-routes-cors api-routes-cors-app
yarn create next-app --example api-routes-cors api-routes-cors-app
pnpm create next-app --example api-routes-cors api-routes-cors-app

Deploy it to the cloud with Vercel (Documentation).