Fetch image in React from Node.js request
问题 When needed, React asks for an image using Superagent : exports.getImgFromSection=function(id,request){ request .get('/img/'+id) .end((error, response) => { if (!error && response) { console.log(response.file); } else { console.log('There was an error fetching server', error); } }) } Node.js answers this way : app.get("/img/:id",function(req, res){ // check if exists and then res.sendFile(path.join(__dirname, './data/img/'+req.params['id']+'.png')); }); But I don't know how to get the image