简体   繁体   中英

How to host react app and node api on server

I have a web app in which front-end is made on reactJs and backend is built on nodejs.Now I want to host this app as I have never host any react app before. SO what I am planning is to host my react part on amazon S3 and nodejs api on heroku.I want to know will this combination work perfectly or I need to try something different.

Please let me know how can I host this full stack app any idea will be appreciated.

THANKS

There are two ways:

  1. You can host your front-end on heroku itself. Build your react project and place your output folder in the node static files folder.
  2. If you want to use separate hosting, I would suggest you to use Netlify for front-end side.

Let me know if it helps.

S3 is storage service, so I don't think it's a good way to deploy your React app. You need a server that has ability to run web server for React application, for example serve , and your option may be EC2 of AWS.

You can deploy your Nodejs API and React part on anywhere (server) and just make sure they can connect together perfectly (call API from backend successfully). Additionally, you can also try to use NGINX as reverse-proxy to your React app.

Reference: CreateReactApp Deployment

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM