0

I deployed a React and Nodejs API backend on different servers. All the servers work well. And I also added the BaseUrl Api route in app-route.js like this -

export const BaseUrl = "http://ec2-11.192.292.19.ap-southeast-1.compute.amazonaws.com/api/v1"

export const Auth_Controller_Login = BaseUrl + "/auth/signin"

But the problem is when I call a react login page from the browser, it freezes and the browser doesn't respond to anything and then I inspected what was wrong. And the error message shows like that -

Failed to load resource: net::ERR_CONNECTION_REFUSED

And also the POST Method from React app only routes to the localhost API backend even though I added the correct nodejs backend BaseUrl. The error shows like that -

POST http://localhost:4002/api/v1/auth/signin net::ERR_CONNECTION_REFUSED

As the error on inspect console shows, the react only routes to localhost. What might possibly seem to be a problem?

5
  • maybe your company laptop firewall blocking them Commented Nov 18, 2021 at 13:13
  • No bro. I tested on my own laptop. Commented Nov 18, 2021 at 13:20
  • try to check is it working on postman Commented Nov 18, 2021 at 13:20
  • bor BaseUrl is wrong http://localhost:4002/api/v1/ Commented Nov 18, 2021 at 13:22
  • Sry. You need to read my question properly. I think you don't get it what I mean. Commented Nov 18, 2021 at 13:23

1 Answer 1

2

you have to mention full URL like this, replace this lines,

export const BaseUrl = "http://ec2-11.192.292.19.ap-southeast-1.compute.amazonaws.com/api/v1"

export const Auth_Controller_Login = BaseUrl + "/auth/signin"

here still baseUrl is getting wrong, so keep full path,

export const Auth_Controller_Login = "http://ec2-11.192.292.19.ap-southeast-1.compute.amazonaws.com/api/v1/auth/signin"

As BaseUrl still keep pointing to wrong path of http://localhost:4002/api/v1/auth/signin

Sign up to request clarification or add additional context in comments.

1 Comment

still pointing to the wrong BaseUrl.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.