Shivam Kumar
Shivam Kumar

Reputation: 133

How to connect NodeJS with ReactJS front-end

I am new to reactJS. I am working on project which uses following :

Front-end : ReactJS

Backend : NodeJS (Express)

Front-end runs on port 3000 Back-end runs on port 8088.

I am planning to deploy application on amazon AWS.

What i am trying to do is load reactJS front-end when i make request on http://localhost:8088/

I know using axios we can make request on backend server and display fetched data.

What would be standard way of loading ReactJS front from the nodeJS ?

Upvotes: 0

Views: 237

Answers (1)

Michal Gally
Michal Gally

Reputation: 147

I'm not sure if this is the answer you are looking for, but generally in development you use something called proxy in your package.json in the client (react) folder:

{
  // Other stuff
  "proxy": "http://localhost:8088"
}

and then when you'd want to deploy you'd run npm build for your react folder and serve that generated folder called build. But as I said, you usually do that only when deploying your application onto server, not the actual development.

Also I'd suggest checking some of these videos, that are focused on deployment, because that is what I think you are asking, right ?

Upvotes: 1

Related Questions