I tried to deploy my app to Heroku, but it is not working correctly. (using create-react-app for frontend and node.js in the backend)
My full app structure looks like this:
my-app
|
| ____ backend
| └── ...
| ____ frontend
└── ...
In the package.json
I've added --dest ../backend/public
to the build script:
scripts": {
"start": "react-scripts start",
"build": "react-scripts build --dest ../backend/public",
},
Then I've ran these commands in the CMD on my backend
folder:
> git init
> heroku create <my-app-name>
And this command on my frontend
folder:
npm run build
Then, in the CMD on my backend
folder:
> git add .
> git commit -m “<commit-messgae>”
> git push heroku master
When I go the my heroku app link I see the "Hello Backend!" message that I wrote in my server.js
file:
app.get('/', (req, res) => {
res.send('Hello Backend!')
})
Please let me know what am I doing wrong. Thanks.