To send image files as API response with Node Express, we call res.sendFile
.
For instance, we write
app.get("/report/:chart_id/:user_id", (req, res) => {
//...
res.sendFile(filePath);
});
to call res.sendFile
with the filePath
to return the image at the filePath
as the response.