@@ -348,7 +348,7 @@ Because `getStaticProps` runs at build time, it does **not** receive data that
...
@@ -348,7 +348,7 @@ Because `getStaticProps` runs at build time, it does **not** receive data that
Note that `getStaticProps` runs only on the server-side. It will never be run on the client-side. It won’t even be included in the JS bundle for the browser. That means you can write code such as direct database queries without them being sent to browsers. You should not fetch an **API route** from `getStaticProps` — instead, you can write the server-side code directly in `getStaticProps`.
Note that `getStaticProps` runs only on the server-side. It will never be run on the client-side. It won’t even be included in the JS bundle for the browser. That means you can write code such as direct database queries without them being sent to browsers. You should not fetch an **API route** from `getStaticProps` — instead, you can write the server-side code directly in `getStaticProps`.
You can use [this tool](https://next-code-elimination.now.sh/) to verify what Next.js eliminates from the client-side bundle.
You can use [this tool](https://next-code-elimination.vercel.app/) to verify what Next.js eliminates from the client-side bundle.
#### Statically Generates both HTML and JSON
#### Statically Generates both HTML and JSON
...
@@ -775,7 +775,7 @@ export default Page
...
@@ -775,7 +775,7 @@ export default Page
- When you request this page directly, `getServerSideProps` runs at the request time, and this page will be pre-rendered with the returned props.
- When you request this page directly, `getServerSideProps` runs at the request time, and this page will be pre-rendered with the returned props.
- When you request this page on client-side page transitions through `next/link` ([documentation](/docs/api-reference/next/link.md)) or `next/router` ([documentation](/docs/api-reference/next/router.md)), Next.js sends an API request to the server, which runs `getServerSideProps`. It’ll return JSON that contains the result of running `getServerSideProps`, and the JSON will be used to render the page. All this work will be handled automatically by Next.js, so you don’t need to do anything extra as long as you have `getServerSideProps` defined.
- When you request this page on client-side page transitions through `next/link` ([documentation](/docs/api-reference/next/link.md)) or `next/router` ([documentation](/docs/api-reference/next/router.md)), Next.js sends an API request to the server, which runs `getServerSideProps`. It’ll return JSON that contains the result of running `getServerSideProps`, and the JSON will be used to render the page. All this work will be handled automatically by Next.js, so you don’t need to do anything extra as long as you have `getServerSideProps` defined.
You can use [this tool](https://next-code-elimination.now.sh/) to verify what Next.js eliminates from the client-side bundle.
You can use [this tool](https://next-code-elimination.vercel.app/) to verify what Next.js eliminates from the client-side bundle.
#### Only allowed in a page
#### Only allowed in a page
...
@@ -808,7 +808,7 @@ function Profile() {
...
@@ -808,7 +808,7 @@ function Profile() {
}
}
```
```
[Check out the SWR documentation to learn more](https://swr.now.sh/).
[Check out the SWR documentation to learn more](https://swr.vercel.app/).
@@ -39,7 +39,7 @@ description: Get to know more about Next.js with the frequently asked questions.
...
@@ -39,7 +39,7 @@ description: Get to know more about Next.js with the frequently asked questions.
<details>
<details>
<summary>How do I fetch data?</summary>
<summary>How do I fetch data?</summary>
<p>It's up to you. You can use the <ahref="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch">fetch API</a> or <ahref="https://swr.now.sh/">SWR</a> inside your React components for remote data fetching; or use our <ahref="/docs/basic-features/data-fetching.md">data fetching methods</a> for initial data population.</p>
<p>It's up to you. You can use the <ahref="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch">fetch API</a> or <ahref="https://swr.vercel.app/">SWR</a> inside your React components for remote data fetching; or use our <ahref="/docs/basic-features/data-fetching.md">data fetching methods</a> for initial data population.</p>
This example sets up the boilerplate for an AMP First Site. You can see a live version [here](https://my-next-app.sebastianbenz.now.sh). The boilerplate includes the following features:
This example sets up the boilerplate for an AMP First Site. You can see a live version [here](https://my-next-app.sebastianbenz.vercel.app). The boilerplate includes the following features:
@@ -49,7 +49,7 @@ Then, open `.env.local` and add the missing environment variables:
...
@@ -49,7 +49,7 @@ Then, open `.env.local` and add the missing environment variables:
-`AUTH0_CLIENT_SECRET` - Can be found in the Auth0 dashboard under `settings`.
-`AUTH0_CLIENT_SECRET` - Can be found in the Auth0 dashboard under `settings`.
-`NEXT_PUBLIC_REDIRECT_URI` - The url where Auth0 redirects back to, make sure a consistent url is used here.
-`NEXT_PUBLIC_REDIRECT_URI` - The url where Auth0 redirects back to, make sure a consistent url is used here.
-`NEXT_PUBLIC_POST_LOGOUT_REDIRECT_URI` - Where to redirect after logging out
-`NEXT_PUBLIC_POST_LOGOUT_REDIRECT_URI` - Where to redirect after logging out
-`SESSION_COOKIE_SECRET` - A unique secret used to encrypt the cookies, has to be at least 32 characters. You can use [this generator](https://generate-secret.now.sh/32) to generate a value.
-`SESSION_COOKIE_SECRET` - A unique secret used to encrypt the cookies, has to be at least 32 characters. You can use [this generator](https://generate-secret.vercel.app/32) to generate a value.
-`SESSION_COOKIE_LIFETIME` - How long a session lasts in seconds. The default is 2 hours.
-`SESSION_COOKIE_LIFETIME` - How long a session lasts in seconds. The default is 2 hours.
@@ -179,7 +179,7 @@ You should now be able to see the draft post. To exit the preview mode, you can
...
@@ -179,7 +179,7 @@ You should now be able to see the draft post. To exit the preview mode, you can
### Step 10. Deploy Strapi
### Step 10. Deploy Strapi
To deploy to production, you must first deploy your Strapi app. The Strapi app for our demo at https://next-blog-strapi.now.sh/ is deployed to Heroku ([here’s the documentation](https://strapi.io/documentation/v3.x/deployment/heroku.html)) and uses Cloudinary for image hosting ([see this file](https://github.com/strapi/strapi-starter-next-blog/blob/master/backend/extensions/upload/config/settings.js)).
To deploy to production, you must first deploy your Strapi app. The Strapi app for our demo at https://next-blog-strapi.vercel.app/ is deployed to Heroku ([here’s the documentation](https://strapi.io/documentation/v3.x/deployment/heroku.html)) and uses Cloudinary for image hosting ([see this file](https://github.com/strapi/strapi-starter-next-blog/blob/master/backend/extensions/upload/config/settings.js)).
This example shows how to use [Magic](https://magic.link) with Next.js. The example features cookie-based, passwordless authentication with email-based magic links.
This example shows how to use [Magic](https://magic.link) with Next.js. The example features cookie-based, passwordless authentication with email-based magic links.
The example shows how to do a login and logout; and to get the user info using a hook with [SWR](https://swr.now.sh).
The example shows how to do a login and logout; and to get the user info using a hook with [SWR](https://swr.vercel.app).
A DB is not included. But you can add any DB you like!.
A DB is not included. But you can add any DB you like!.
-[SWR](https://swr.now.sh/) — dynamically changing the `refreshInterval` depending on if the client should be polling for updates or not
-[SWR](https://swr.vercel.app/) — dynamically changing the `refreshInterval` depending on if the client should be polling for updates or not
-[`/pages/api`](pages/api) routes — a couple endpoints for making authenticated requests to the Mux API.
-[`/pages/api`](pages/api) routes — a couple endpoints for making authenticated requests to the Mux API.
- Dynamic routes using [`getStaticPaths` and `fallback: true`](https://nextjs.org/docs/basic-features/data-fetching#getstaticpaths-static-generation), as well as dynamic API routes.
- Dynamic routes using [`getStaticPaths` and `fallback: true`](https://nextjs.org/docs/basic-features/data-fetching#getstaticpaths-static-generation), as well as dynamic API routes.
This example creates a basic [CRUD](https://en.wikipedia.org/wiki/Create,_read,_update_and_delete) app using [next-connect](https://github.com/hoangvvo/next-connect) and cookie-based authentication with [Passport.js](http://www.passportjs.org/). The cookie is securely encrypted using [@hapi/iron](https://github.com/hapijs/iron).
This example creates a basic [CRUD](https://en.wikipedia.org/wiki/Create,_read,_update_and_delete) app using [next-connect](https://github.com/hoangvvo/next-connect) and cookie-based authentication with [Passport.js](http://www.passportjs.org/). The cookie is securely encrypted using [@hapi/iron](https://github.com/hapijs/iron).
The example shows how to do a sign up, login, logout, and account deactivation. It utilizes [SWR](https://swr.now.sh/) to fetch the API.
The example shows how to do a sign up, login, logout, and account deactivation. It utilizes [SWR](https://swr.vercel.app/) to fetch the API.
For demo purpose, the users database is stored in the cookie session. You need to replace it with an actual database to store users in [db.js](lib/db.js).
For demo purpose, the users database is stored in the cookie session. You need to replace it with an actual database to store users in [db.js](lib/db.js).
This example show how to use [Passport.js](http://www.passportjs.org) with Next.js. The example features cookie based authentication with username and password.
This example show how to use [Passport.js](http://www.passportjs.org) with Next.js. The example features cookie based authentication with username and password.
The example shows how to do a login, signup and logout; and to get the user info using a hook with [SWR](https://swr.now.sh).
The example shows how to do a login, signup and logout; and to get the user info using a hook with [SWR](https://swr.vercel.app).
A DB is not included. You can use any db you want and add it [here](lib/user.js).
A DB is not included. You can use any db you want and add it [here](lib/user.js).
@@ -8,7 +8,7 @@ Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
...
@@ -8,7 +8,7 @@ Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_mediu
[](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/with-react-multi-carousel&project-name=with-react-multi-carousel&repository-name=with-react-multi-carousel)
[](https://vercel.com/new/git/external?repository-url=https://github.com/vercel/next.js/tree/canary/examples/with-react-multi-carousel&project-name=with-react-multi-carousel&repository-name=with-react-multi-carousel)
@@ -110,7 +110,7 @@ The CLI will print a webhook secret key to the console. Set `STRIPE_WEBHOOK_SECR
...
@@ -110,7 +110,7 @@ The CLI will print a webhook secret key to the console. Set `STRIPE_WEBHOOK_SECR
### Setting up a live webhook endpoint
### Setting up a live webhook endpoint
After deploying, copy the deployment URL with the webhook path (`https://your-url.now.sh/api/webhooks`) and create a live webhook endpoint [in your Stripe dashboard](https://stripe.com/docs/webhooks/setup#configure-webhook-settings).
After deploying, copy the deployment URL with the webhook path (`https://your-url.vercel.app/api/webhooks`) and create a live webhook endpoint [in your Stripe dashboard](https://stripe.com/docs/webhooks/setup#configure-webhook-settings).
Once created, you can click to reveal your webhook's signing secret. Copy the webhook secret (`whsec_***`) and add it as a new environment variable in your [Vercel Dashboard](https://vercel.com/dashboard):
Once created, you can click to reveal your webhook's signing secret. Copy the webhook secret (`whsec_***`) and add it as a new environment variable in your [Vercel Dashboard](https://vercel.com/dashboard):