Monday 5 June 2017

Unable to access external REST endpoint from NodeJS application bundled with webpack

I'm trying to access a REST endpoint provided at localhost:5002/getdata from a NodeJS application bundled with Webpack. I'm able to access the endpoint from a REST client but it doesn't work from within the application. Can someone please point out where I'm going wrong?

request.get('http://127.0.0.1:5002/getdata')
      .set('Accept', 'application/json')
      .end((err, res) => {
        if (res && res.status === 200) {
          //Do something
        }



via Kapil

No comments:

Post a Comment