Passing response from API as response from my node server throws Passing response from API as response from my node server throws express express

Passing response from API as response from my node server throws


Well, the easiest way would probably be to pipe the response down to the client:

  router.get('/', (req, res) => {    axios({      method: 'get',      url: apiUrl,      responseType: 'stream'    })      .then(function(response) {        response.data.pipe(res)    });  });

If there's an issue with the format from the third party, you're still out of luck, but this will at least take your server-side processing out of the mix as the problem, and also performance should be a little better since you're just piping the response down rather than getting the full response on the server, serializing it to JSON only to re-send it to the response stream.