本文所分享的知识点是【node.js中的http.response.end方法使用说明】,欢迎您喜欢我爱IT技术网所分享的教程、知识、经验或攻略,下面是详细的讲解。
node.js中的http.response.end方法使用说明
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);
关于node.js中的http.response.end方法使用说明的相关讨论如下:
相关问题:node.js的http模块如何使用?
答:安装好node后,自带了http模块,可以直接使用 ----------- var http = require('http'); http.createServer(function (request, response) { response.writeHead(200, {'Content-Type': 'text/plain'}); response.end('Hello World\n'); }).lis... >>详细
相关问题:Node.js的HTTP与事件初步介绍&怎么查看API
答:Node.js的HTTP与事件初步介绍&如何查看API(入门篇) Node.js的HTTP与事件初步介绍&如何查看API(入门篇) 接着第一篇来说,当然,同样约定下面简称为Node(个人认为比较标准的说法),标题用node.js主要是为了方便阅读。同样,大牛可以略过这篇文章啦... >>详细
相关问题:如何让nodejs的多个http请求全部响应回来后才让程...
答:function requestWithTimeout(options,timeout,callback){ var timeoutEventId, req=http.request(options,function(res){ res.on('end',function(){ clearTimeout(timeoutEventId); console.log('response end...'); }); res.on('close',functi >>详细
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
