Deployment

Your React client will run in development mode - when you want to deploy to a live server, you will need to build the front-end and serve the static files.

// build the client
cd client && npm run build

You can run this file before you deploy, or set it as a post build script in package.json if your hosting provider supports post build scripts.

If you're deploying the server and client together, you will need to add the following lines to server.js to serve the static files from Express.

app.use(express.static(path.join(__dirname, 'client/build')));
app.get('*', (req, res) => {
res.sendFile(path.join(__dirname + '/client/build/index.html'))
});

Deployment Tutorials

How to Deploy Gravity to Heroku