My goal is to send an image from the server (currently stored in local storage) to the client. Below is a snippet of my code:
exports.get_icon = (req, res) => {
App.findOne({name: req.body.name}, (error, application) => {
if(error){
console.log(error);
} else{
console.log(application);
res.status(200).send(application.iconImage) //!!need to do something here
}
})
}
In this function, I intend to retrieve the path where the image is stored and then transmit it to the client. Currently, the server sends the path of the image instead of the actual image. For example, it might be like this uploads/Twitter/icon.png
. So how can I successfully send the image from the server to the client with the understanding that application.iconImage
provides the path of the image?