A
A
Alexey Kisilev2019-07-14 15:49:56
JavaScript
Alexey Kisilev, 2019-07-14 15:49:56

How to upload an html file with an image?

I have a code that sends an html file:
const express = require("express");
var app = express();
app.use(express.static('public'));
app.get('/', function (req, res) {
res.sendFile(__dirname + '/index.html');
});
As well as the code that sends the image, where the path to the image is stored in an array
5d2b24e337ff5779095132.png
Question: how can I send an html file already with an image?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2019-07-14
@rockon404

You cannot handle two identical GET paths. The router will only process the first one.
Images must be put in a public folder and written in html. You have static middleware connected, so there shouldn't be any problems.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question