0

I have an express app which listening on port 5000 like this:

app.listen(5000, "0.0.0.0, ()=>'Server started on' + 'port ' + 5000).

When I try to send a post request by node script using axios or curl its response me 200.

axios.post('http://localhost:5000/api/auth/login', {})

or

curl -d "username=daniel&password=daniel&role=owner" -X POST http://localhost:5000/api/auth/login

But I when I try sending the same request using Angular HttpClient.Post its gives me an error :

POST http://localhost:5000/api/auth/login net::ERR_CONNECTION_REFUSED

The problem started when I tried to run all of these components on a remote server.

it works for me fine when I tried to run all of these components on my local machine.

Any ideas why it should happen?

I would appreciate your help!

2
  • The web app is no longer on localhost:5000! Use the correct URL. Commented Nov 20, 2020 at 12:18
  • @MichaelHampton Thank you so much! it worked! Commented Nov 20, 2020 at 13:38

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.