Answer the question
In order to leave comments, you need to log in
How to distribute express + vue statics?
Good afternoon.
You need to save images to the project folder, and then display them in the project.
I'm trying to access the file both on the local server and on the domain, it doesn't work. What am I doing wrong?
localhost:8080/files/1.jpg
domain.ru/files/1.jpg
app.use('/files', express.static(__dirname + 'files'));
app.use('/', express.static(path.join(__dirname, 'client', 'dist')))
app.get('*', (req, res) => {
res.sendFile(path.resolve(__dirname, 'client', 'dist', 'index.html'))
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question