Answer the question
In order to leave comments, you need to log in
Is there a universal solution for headers?
Hello.
Wondering if there is a generic solution for
res.setHeader('Content-type', 'text/html; charset=utf-8');
I don’t know what header to put when requesting files (.css, .js, etc.), i.e. by default when accessing the server.
I put one, the second does not load.
The solution is needed on a vanilla node.
example in code
Answer the question
In order to leave comments, you need to log in
Use it and don't be shy :)
const path = require('path');
app.use(express.static(path.join(__dirname, "static")));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question