diff --git a/examples/with-zeit-fetch/.gitignore b/examples/with-vercel-fetch/.gitignore similarity index 100% rename from examples/with-zeit-fetch/.gitignore rename to examples/with-vercel-fetch/.gitignore diff --git a/examples/with-vercel-fetch/README.md b/examples/with-vercel-fetch/README.md new file mode 100644 index 0000000000000..101bd66f0c3a0 --- /dev/null +++ b/examples/with-vercel-fetch/README.md @@ -0,0 +1,19 @@ +# @vercel/fetch example + +This example shows how to use [`@vercel/fetch`](https://www.npmjs.com/package/@vercel/fetch) in a Next.js application. + +## Deploy your own + +Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example): + +[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/with-vercel-fetch&project-name=with-vercel-fetch&repository-name=with-vercel-fetch) + +## 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) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example: + +```bash +npx create-next-app --example with-vercel-fetch with-vercel-fetch-app +# or +yarn create next-app --example with-vercel-fetch with-vercel-fetch-app +``` diff --git a/examples/with-zeit-fetch/fetch/browser.js b/examples/with-vercel-fetch/fetch/browser.js similarity index 100% rename from examples/with-zeit-fetch/fetch/browser.js rename to examples/with-vercel-fetch/fetch/browser.js diff --git a/examples/with-zeit-fetch/fetch/package.json b/examples/with-vercel-fetch/fetch/package.json similarity index 100% rename from examples/with-zeit-fetch/fetch/package.json rename to examples/with-vercel-fetch/fetch/package.json diff --git a/examples/with-vercel-fetch/fetch/server.js b/examples/with-vercel-fetch/fetch/server.js new file mode 100644 index 0000000000000..fbeb2051e3e7e --- /dev/null +++ b/examples/with-vercel-fetch/fetch/server.js @@ -0,0 +1,4 @@ +import createFetch from '@vercel/fetch' + +// since we aren't providing createFetch a fetcher it will use node-fetch as the fetcher +export default createFetch() diff --git a/examples/with-zeit-fetch/package.json b/examples/with-vercel-fetch/package.json similarity index 61% rename from examples/with-zeit-fetch/package.json rename to examples/with-vercel-fetch/package.json index cb48ad4d81368..656fdc428862b 100644 --- a/examples/with-zeit-fetch/package.json +++ b/examples/with-vercel-fetch/package.json @@ -1,5 +1,5 @@ { - "name": "with-zeit-fetch", + "name": "with-vercel-fetch", "version": "1.0.0", "scripts": { "dev": "next", @@ -7,12 +7,12 @@ "start": "next start" }, "dependencies": { - "@zeit/fetch": "5.1.1", + "@vercel/fetch": "6.1.0", "next": "latest", "node-fetch": "2.6.1", - "react": "^16.8.4", - "react-dom": "^16.8.4", - "unfetch": "4.1.0" + "react": "17.0.1", + "react-dom": "17.0.1", + "unfetch": "4.2.0" }, "license": "MIT" } diff --git a/examples/with-zeit-fetch/pages/index.js b/examples/with-vercel-fetch/pages/index.js similarity index 100% rename from examples/with-zeit-fetch/pages/index.js rename to examples/with-vercel-fetch/pages/index.js diff --git a/examples/with-zeit-fetch/pages/preact.js b/examples/with-vercel-fetch/pages/preact.js similarity index 100% rename from examples/with-zeit-fetch/pages/preact.js rename to examples/with-vercel-fetch/pages/preact.js diff --git a/examples/with-zeit-fetch/README.md b/examples/with-zeit-fetch/README.md deleted file mode 100644 index 647b7222eb688..0000000000000 --- a/examples/with-zeit-fetch/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# @zeit/fetch example - -This example shows how to use [`@zeit/fetch`](https://npmjs.com/package/@zeit/fetch) in a Next.js application. - -## Deploy your own - -Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example): - -[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/with-zeit-fetch&project-name=with-zeit-fetch&repository-name=with-zeit-fetch) - -## 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) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example: - -```bash -npx create-next-app --example with-zeit-fetch with-zeit-fetch-app -# or -yarn create next-app --example with-zeit-fetch with-zeit-fetch-app -``` - -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)). diff --git a/examples/with-zeit-fetch/fetch/server.js b/examples/with-zeit-fetch/fetch/server.js deleted file mode 100644 index 618baba1f3566..0000000000000 --- a/examples/with-zeit-fetch/fetch/server.js +++ /dev/null @@ -1,3 +0,0 @@ -import zeitFetch from '@zeit/fetch' - -export default zeitFetch()