Answer the question
In order to leave comments, you need to log in
Why is the nginx and fs node not designed to load html?
Guys, tell a newbie please
Why do we need an nginx node, if we are on a node and write a server like that?
And require("fs")
it serves exclusively for downloading files, and not the html code of the page?
Everywhere it is customary to design html code directly in the js file and through ' ' with +?
But how to load styles here?
It seemed to me that fs should have done this, but I never saw a full-fledged example.
And what does Handler mean? Why is it called that in many languages and what does it imply?
I didn't see it as a method, but as a name it is used a lot.
var querystring = require("querystring"),
fs = require("fs"),
formidable = require("formidable");
function start(response) {
console.log("Request handler 'start' was called.");
var body = '<html>'+
'<head>'+
'<meta http-equiv="Content-Type" '+
'content="text/html; charset=UTF-8" />'+
'</head>'+
'<body>'+
'<form action="/upload" enctype="multipart/form-data" '+
'method="post">'+
'<input type="file" name="upload" multiple="multiple">'+
'<input type="submit" value="Upload file" />'+
'</form>'+
'</body>'+
'</html>';
response.writeHead(200, {"Content-Type": "text/html"});
response.write(body);
response.end();
}
Answer the question
In order to leave comments, you need to log in
Your code example is ....))) In general, you don't need it anymore =)
Thank God it's not accepted like that anywhere))
But how to load styles here?
It seemed to me that fs should have taken care of this,
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question