title: Issues on using Axios to send HTTP request from a localhost Express API to another
body: <p>I have a Express API sitting on 127.0.0.1:8001
  and the endpoint code is like</p>
  <pre><code>    app.get('/api/register-logging', async (req, res)=&gt; {
         try {
              await axios.get('127.0.0.1:5000/register', {
                 name:&quot;shawn&quot;
             }).then( response =&gt; {
                 console.log(response.data);
                 res.json(response.data);
             })
         }catch (e){
             console.log(e);
         }
      });
  
  </code></pre>
  <p>I have another flask service sitting on 127.0.0.1:5000 has an /register endpoint for the request abobe, I have installed the CORS in my express but I am still getting errors in the following</p>
  <pre><code>Error: getaddrinfo ENOTFOUND 5000
      at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:66:26) {
    errno: -3008,
    code: 'ENOTFOUND',
    syscall: 'getaddrinfo',
    hostname: '5000',
    config: {
      url: 'localhost:5000/register',
      method: 'get',
      headers: {
        Accept: 'application/json, text/plain, */*',
        'User-Agent': 'axios/0.21.0'
      },
      transformRequest: [ [Function: transformRequest] ],
      transformResponse: [ [Function: transformResponse] ],
      timeout: 0,
      adapter: [Function: httpAdapter],
      xsrfCookieName: 'XSRF-TOKEN',
      xsrfHeaderName: 'X-XSRF-TOKEN',
      maxContentLength: -1,
      maxBodyLength: -1,
      validateStatus: [Function: validateStatus],
      name: 'amber',
      data: undefined
    },
    request: &lt;ref *1&gt; Writable {
      _writableState: WritableState {
        objectMode: false,
        highWaterMark: 16384,
        finalCalled: false,
        needDrain: false,
        ending: false,
        ended: false,
        finished: false,
        destroyed: false,
        decodeStrings: true,
        defaultEncoding: 'utf8',
        length: 0,
        writing: false,
        corked: 0,
        sync: true,
        bufferProcessing: false,
        onwrite: [Function: bound onwrite],
        writecb: null,
        writelen: 0,
        afterWriteTickInfo: null,
        buffered: [],
        bufferedIndex: 0,
        allBuffers: true,
        allNoop: true,
        pendingcb: 0,
        prefinished: false,
        errorEmitted: false,
        emitClose: true,
        autoDestroy: true,
        errored: false,
        closed: false
      },
      _events: [Object: null prototype] {
        response: [Function: handleResponse],
        error: [Function: handleRequestError]
      },
      _eventsCount: 2,
      _maxListeners: undefined,
      _options: {
        maxRedirects: 21,
        maxBodyLength: 10485760,
        protocol: 'http:',
        path: '/register',
        method: 'GET',
        headers: [Object],
        agent: undefined,
        agents: [Object],
        auth: undefined,
        hostname: '5000',
        port: null,
        nativeProtocols: [Object],
        pathname: '/register'
      },
      _ended: true,
      _ending: true,
      _redirectCount: 0,
      _redirects: [],
      _requestBodyLength: 0,
      _requestBodyBuffers: [],
      _onNativeResponse: [Function (anonymous)],
      _currentRequest: ClientRequest {
        _events: [Object: null prototype],
        _eventsCount: 7,
        _maxListeners: undefined,
        outputData: [],
        outputSize: 0,
        writable: true,
        destroyed: false,
        _last: true,
        chunkedEncoding: false,
        shouldKeepAlive: false,
        useChunkedEncodingByDefault: false,
        sendDate: false,
        _removedConnection: false,
        _removedContLen: false,
        _removedTE: false,
        _contentLength: 0,
        _hasBody: true,
        _trailer: '',
        finished: true,
        _headerSent: true,
        socket: [Socket],
        _header: 'GET /register HTTP/1.1\r\n' +
          'Accept: application/json, text/plain, */*\r\n' +
          'User-Agent: axios/0.21.0\r\n' +
          'Host: 5000\r\n' +
          'Connection: close\r\n' +
          '\r\n',
        _onPendingData: [Function: noopPendingOutput],
        agent: [Agent],
        socketPath: undefined,
        method: 'GET',
        maxHeaderSize: undefined,
        insecureHTTPParser: undefined,
        path: '/register',
        _ended: false,
        res: null,
        aborted: false,
        timeoutCb: null,
        upgradeOrConnect: false,
        parser: null,
        maxHeadersCount: null,
        reusedSocket: false,
        host: '5000',
        protocol: 'http:',
        _redirectable: [Circular *1],
        [Symbol(kCapture)]: false,
        [Symbol(kNeedDrain)]: false,
        [Symbol(corked)]: 0,
        [Symbol(kOutHeaders)]: [Object: null prototype]
      },
      _currentUrl: 'http://5000/register',
      [Symbol(kCapture)]: false
    },
    response: undefined,
    isAxiosError: true,
    toJSON: [Function: toJSON]
  }
  </code></pre>
  <p>Judging from  _currentUrl: 'http://5000/register', looks like the server cannot intepret the URI, I have used POSTMAN to test the /register endpoint which is workable,I can not make it work inside the API. I have enabled the 127.0.0.1 localhost configuration in the C:\Windows\System32\drivers\etc  Host File. Did not solve the issue, PLease Help. THank you very much!!</p>