I
I
Ingerniated2016-10-13 19:46:48
Node.js
Ingerniated, 2016-10-13 19:46:48

Gentlemen, do not take it as impudence, how to connect css to html in node?

Tell me more, please, what logic or thoughts should I be guided by in order to configure statics and a router on the server, is the scheme the same in all server languages?
var http = require("http");
var fs = require("fs");
http.createServer(function(request, response) {
fs.readFile("home.html" + request.url , (err, file) => {
if (err) {
response.writeHead(404, {"Content-type" : "text/html"});
response.write("file not found");
response.end();
}
else {
response.writeHead(200, {"Content-type" : "text/html"});
response.write(file);
response.write("s/css.css");
}).listen(8000);

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question