node.js 学习记录(一)安装

来源:互联网 发布:淘宝特价 编辑:程序博客网 时间:2024/05/21 03:20

一、安装和测试

1.安装去官网下个包,一键安装。

2.安装后运行  使用node.js command prompt 命令窗口 或者 使用windows 自带dos窗口

3.测试安装代码(网上到处都是一样的)

var http = require("http"); http.createServer(function(request, response) { response.writeHead(200, {"Content-Type": "text/plain"}); response.write("test nodjs"); response.end(); }).listen(8899); console.log("nodejs start listen 8899 port!");
4.保存为 node.js 到D: 盘

5. 运行 node d:\\node.js

6.保持窗口,打开浏览器访问:http://127.0.0.1:8899/。看到test nodjs。测试成功!

0 0
原创粉丝点击