14.11.3【node.js】做一个最简单的helloworld程序

来源:互联网 发布:3ds删除软件 编辑:程序博客网 时间:2024/06/10 08:06
//调用httpvar http = require('http');http.createServer(function (req, res) {    //200是http状态码,比如404是服务器错误,200是正常运行    res.writeHead(200, { 'Content-Type': 'text/plain' });    res.end('Hello World\n');    //4000是端口名称 随便写一个数就行}).listen(4000);//cosole.log是C语言printf的意思,输出,console是控制台console.log('Server running at port 4000');//运行此程序在网页上输入 http://localhost:4000/

0 0
原创粉丝点击