91
rated 0 times
[
96]
[
5]
/ answers: 1 / hits: 12888
/ 4 Years ago, thu, march 19, 2020, 12:00:00
I want my the /image
of my app to return a random image, how can I do that?
app.js:
const app = express();
app.get('/image', async (req, res) => {
const url = 'https://example.com/images/test.jpg';
res.send(/**/); // How do I send the image binary data from the url?
});
index.html
In HTML, this image actually shows the content of the image https://example.com/images/test.jpg
<img src=https://my-app.com/image />
More From » node.js