A combo of two npm projects, the backend server and the frontend UI. So there are two package.json configs.
package.jsonfor Node server & Heroku deployheroku-postbuildscript compiles the webpack bundle during deploycacheDirectoriesincludesreact-ui/node_modules/to optimize build time
react-ui/package.jsonfor React web UI- generated by create-react-app
git clone
cd /
heroku create
git push heroku masterThis deployment will automatically:
- detect Node buildpack
- build the app with
npm installfor the Node serverheroku-postbuildfor create-react-app
- launch the web process with
npm start- serves
../react-ui/build/as static files
- serves
👓 More about deploying to Heroku.
In a terminal:
# Initial setup
npm install
# Start the server
npm startThe React UI is configured to proxy backend requests to the local Node server. (See "proxy" config)
In a separate terminal from the API server, start the UI:
# Always change directory, first
cd react-ui/
# Initial setup
npm install
# Start the server
npm start