If you build a React app using create-react-app
, you can deploy it to a few places
There are many other platforms for deploying your applications. For React apps, the create-react-app README page has a great write-up on other ways to deploy your react applications.
If you are building a web application using create-react-app, you need to build
the application first before you can deploy it to now
.
There are two ways.
In your project root directory (created by create-react-app):
Run the following commands:
npm run build
cd build
now
On the console, you will see the URL where your website is deployed to.
For this approach, you need to provide a configuration file called now.json
which tells now
how to build your application.
The detailed steps can be found here
If you cannot put the environment variables into .env
file for some reason, you can also set it via Now.
Check out their documentation.
If the environment variable is a secret, you should also be careful and don't check it into your public code repository.
Here is how you can manage secrets on the Now platform
You can follow instructions here