https://nodejs.org/en/download/
官网下载地址

今天学习node.js 本地搭建

windows 安装 下一步下一步就OK了
我们windows+r 进入cmd 命令 输入
node -v 查看node.js 版本
npm -v 查看是否安装npm ,npm的版本
今天学习node.js 本地搭建
我们在D盘建立一个 js/test.js 文件
test.js 内容

var http = require("http");

http.createServer(function(req, res) {

res.writeHead( 200 , {"Content-Type":"text/html"});

res.write("

Node.js

");

res.write("

Hello World

");

res.end("

beyondweb.cn

");

}).listen(3000);

console.log("HTTP server is listening at port 3000.");

创建一个HTTP 服务端口为3000
cmd 运行进入文件所在文件夹 node test.js
执行打印出 HTTP server is listening at port 3000.
我们访问本地ip地址
127.0.0.1:3000
今天学习node.js 本地搭建
详情开发请参考文档http://nodejs.cn/

相关文章:

  • 2021-10-23
  • 2022-01-08
  • 2021-05-19
  • 2021-12-09
  • 2021-09-30
  • 2021-11-09
  • 2021-07-21
猜你喜欢
  • 2022-01-08
  • 2022-01-08
  • 2022-01-08
  • 2021-12-12
  • 2021-07-18
  • 2022-01-08
  • 2021-10-14
相关资源
相似解决方案