In this article, we will explore, Step by step instructions for deploying React + Node.js app to Heroku which we created in my previous article HER...
Some comments have been hidden by the post's author - find out more
For further actions, you may consider blocking this person and/or reporting abuse
Hello,
can you please look into my code? I just use the approach that you explained. I am able to create an app on localhost:5000 but when I deployed it in Heroku. I can't get the response from the POST request. All it is giving me is 405 error. I have been fixing it for 2 days but not getting any solutions. If you can help me it will be highly appreciated.
Here is the error code:
Uncaught (in promise) Error: Request failed with status code 405
here is my code:
github.com/sajpanchal/portfolio
@sajpanchal There are some changes you need to make.
node_modules
as content of the file so it will not be pushed to GitHub.dotenv
package insidedependencies
section of server/package.json file and remove it fromdevDependencies
.instead of
Here's a deployed version of your portfolio. I have not entered the valid email and password in environment variables so the contact us form will not work. Make sure you add correct values for following environment variables:
Thanks so much for this, I never had a front and back using React. Only ejs and stuff so there had never been this kind of issue. Tested it locally and it worked! And now will deploy to remote (Heroku) and see what happens!
Yogesh, it worked like a charm! Again, thanks so much!
Glad to hear that @letsbsocial1 . Thank you 🙏
Thank you. Actually, I fixed it earlier by reinstalling node packages and creating a new Heroku app. It started to work after that updates without doing anything in the code. I appreciate your response. The mistakes you pointed out will be useful in the future though.
Deployed but had some problems... I deleted the heroku app tried again but this time I got a error in the build-> Node version not specified in package.json. So i added this in my package.json and it worked...
"engines": {
"node": "14.15.1",
"npm": "7.6.2"
},
Awesome 👍
I was able to get my separated frontend and backend wired perfectly for heroku following these instructions. Thanks for this.
Glad to hear that @lenicholsdev . Thank you 🙂
Hi @myogeshchavan97, Thanks for this. I have tried your solution to connect my frontend and backend applications to one, and it worked! But, I am facing a problem for all other endpoints instead of "/". I am not able to fetch the any other page. It's only working for home page. Can you please help me with what mistake I might be committing here?
UPDATE: Added the following code in server/index.js to resolve it.
Make sure that you add this code after such functions in your index.js file.
You just save my life with this man, thanks a lot
glad to hear that 🙏
Hello Yogesh,
I have followed all of the steps in both articles but when I click search, loading pops up really fast and disappears w/out displaying the jobs. Any suggestions?
@kanetoomer The GitHub Jobs API is deprecated and is no longer available. You can try using the hardcoded JSON data from this file and use it so you will see the list of jobs displayed when clicked on search.
Thank you, I have figured it out now.
Will it work if I have .env and add vars manually ? the environtment using REACT_APP_
we don't push .env file to github for security reasons. So you will need to add environment variables through UI for Heroku.