目前我正在尝试学习什么是 node.js。我已经在 Windows 中安装了 node.exe,不知道下一步要做什么
你们能帮帮我吗
最佳答案
您创建一个 js 文件,编写代码并使用 node.exe path/to/file.js
启动服务器。之后,您可以打开浏览器并查看程序。
这里有一个例子(helloWorld.js
):
var http = require('http');
var server = http.createServer(function(req, res) {
res.writeHead(200);
res.end('Hello World!');
}).listen(8080);
node.exe helloWorld.js
打开浏览器并查看 localhost:8080
关于node.js - 在 Windows 7 中安装 Node.exe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12086580/