rsnext/examples/with-now-env/README.md

43 lines
1.6 KiB
Markdown
Raw Normal View History

2018-03-29 00:11:40 +02:00
# Now-env example
This example shows the usage of [Now Secrets](https://vercel.com/docs/v2/deployments/environment-variables-and-secrets/?query=secret#securing-environment-variables-using-secrets) and [now dev](https://vercel.com/docs/v2/development/basics), it shows how to add environment variables in development that can be replaced in production by the secrets defined with [Now](https://vercel.com/now).
2018-03-29 00:11:40 +02:00
## How to use
### Using `create-next-app`
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::
2018-03-29 00:11:40 +02:00
```bash
npm init next-app --example with-now-env with-now-env-app
2018-03-29 00:11:40 +02:00
# or
yarn create next-app --example with-now-env with-now-env-app
```
### Download manually
Download the example:
2018-03-29 00:11:40 +02:00
```bash
curl https://codeload.github.com/vercel/next.js/tar.gz/canary | tar -xz --strip=2 next.js-canary/examples/with-now-env
2018-03-29 00:11:40 +02:00
cd with-now-env
```
2019-06-29 00:14:57 +02:00
Install it with `npm` or `yarn`:
2018-03-29 00:11:40 +02:00
```bash
npm install
2019-06-29 00:14:57 +02:00
# or
yarn
```
Start the development server with [now](https://vercel.com/now) ([download](https://vercel.com/download)):
2019-06-29 00:14:57 +02:00
```bash
now dev
2018-03-29 00:11:40 +02:00
```
Deploy it to the cloud with [Vercel](https://vercel.com/import?filter=next.js&utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).
2018-03-29 00:11:40 +02:00
Keep in mind that in order to deploy the app to Vercel the env [secrets](https://vercel.com/docs/getting-started/secrets) defined in `now.json` should be listed in your account.