I'm self-learning web development using React, Node, and Express, and am trying to deploy my app to Heroku.
The problem I'm facing is that locally I can run both my server and client with no issue using npm start for the client and node server.js to start my express server.
However, I haven't been able to find an appropriate way to do something similar on Heroku - I've read through all the articles about deploying similar apps to Heroku and running my react client through the express server, but haven't managed to get it working.
Here's some additional info that might be relevant:
- I created my react app using create-react-app, so it has a public folder (which I haven't actually touched at all apart from attempting to run my react js scripts through index.html) and a src folder which contains all my react components and the index which renders the app
- My server.js file is in the root of my git directory, and locally everything it should do works.
- I've tried using package.json scripts to run the
node server.jscommand in the postbuild, but if I use thenodecommand anywhere at all, my console is blocked by the server running once the command runs (ie when I use git push heroku master, once it reaches this command it is blocked)
Please let me know if more info is needed, any help would be appreciated.
Cheers