Skip to content

ECONNREFUSED Error #3708

@sv-du

Description

@sv-du

Describe the issue

I keep trying to send a GET request to an api, but it keeps on returning the following error
Error: connect ECONNREFUSED 127.0.0.1:80

Example Code

Code snippet to illustrate your question

client.getIdFromUsername = async function(username) {
    const axios = require('axios').default;
    let id;
    try {
        let res = await axios({
            url: `PRIVATE_API/users/get-by-username?username=${username}`,
            method: "GET"
        });
        id = res.data.Id;
    } catch(err) {
        return err;
    }
    return id;
}

Expected behavior, if applicable

It sends the request successfully and returns the user ID of the username

Environment

  • Axios Version [0.21.1]
  • Node.js Version [15.7.0]
  • OS: [Windows 10]

Additional context/Screenshots

NONE

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions