Method description:
End the response and tell the client that all messages have been sent. When all the content to be returned is sent, the function must be called once.
How to not call this function, the client will always be in a waiting state.
grammar:
The code copy is as follows:
response.end([data], [encoding])
Receive parameters:
data end() will be executed after the character to be output. If the value of data is specified, it means that after the response.end() is executed, a response.write(data, encoding);
encoding character encoding corresponding to data
example:
The code copy is as follows:
var http = require('http');
http.createServer(function(req, res){
res.writeHead(200, {'Content-type' : 'text/html'});
res.write('<h1>Node.js</h1>');
res.end('<p>Hello World</p>');
}).listen(3000);