Answers for "how to host react app on heroku"

4

how to host react app on heroku

npm install -g create-react-app
create-react-app my-app
cd my-app
git init
heroku create -b https://github.com/mars/create-react-app-buildpack.git
git add .
git commit -m "react-create-app on Heroku"
git push heroku master
heroku open
Posted by: Guest on February-14-2020
-1

deploy react app to heroku

const path = require('path');const express = require('express');const app = express();const publicPath = path.join(__dirname, '..', 'public');const port = process.env.PORT || 3000;app.use(express.static(publicPath));app.get('*', (req, res) => {   res.sendFile(path.join(publicPath, 'index.html'));});app.listen(port, () => {   console.log('Server is up!');});
Posted by: Guest on July-21-2020

Code answers related to "how to host react app on heroku"

Code answers related to "Javascript"

Browse Popular Code Answers by Language