Instructions for using the Http.response.end method in node. js

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.