fe797c1074
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)
1.5 KiB
1.5 KiB
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
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).