The http. response. end method in node. js is described in node. jshttp. get.
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.
If you do not call this function, the client will always be in the waiting state.
Syntax:
Copy codeThe Code is as follows:
Response. end ([data], [encoding])
Receiving parameters:
The character to be output after data end () is executed. If the value of data is specified, it means the response is executed. after end (), a response is executed. write (data, encoding );
Character encoding of data corresponding to encoding
Example:
Copy codeThe Code is as follows:
Var http = require ('http ');
Http. createServer (function (req, res ){
Res. writeHead (200, {'content-type': 'text/html '});
Res. write ('Res. end ('<p> Hello World </p> ');
}). Listen (3000 );