Reprinted from: http://m.jb51.net/article/58468.htm
This article describes theHttp.response.endMethod description, syntax, receive parameters, use instances and realize the source code, the need for friends can refer to the following
Method Description:
Ends the response, telling the client that all messages have been sent. The function must be called once when all the content to be returned has been sent.
If you do not call this function, the client will always be in a wait state.
Grammar:
Response.End ([Data], [encoding])
Receive parameters:
Data : The character to be output when end () is executed, if the value of data is specified, it means that a Response.Write (data, encoding) will be executed after Response.End () is completed;
encoding: Character encoding for the corresponding data
Example:
The code is as follows:
var http = require (' http '); http.createserver(function(req, res) { Res.writehead ( {' Content-type ': ' text/html '}); Res.write (' ); Res.end ( ' <p>hello world</p> ' );}). Listen (3000);
Instructions for using the Http.response.end method in node. js