直接用文本编辑器编写helloworld.js,保存在桌面
var http = require("http");
http.createServer(function(request, response) {
response.write("Hello World");
response.end();
}).listen(8080);
console.log("nodejs start listen 8080 port!");

在浏览器中访问http://localhost:8088/
会看到显示
Hello World
使用Node.js创建简单的HTTP服务器
本文介绍如何使用Node.js编写一个基本的HTTP服务器,并通过浏览器访问实现简单响应。
149

被折叠的 条评论
为什么被折叠?



