源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

快速掌握Node.js之Window下配置NodeJs环境

  • 时间:2020-06-08 15:46 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:快速掌握Node.js之Window下配置NodeJs环境
在window下也动手试了下,完美安装,测试通过! [b]1.下载node[/b] 在https://nodejs.org/en/中下载node,我选的是左侧稳定版本 [img]http://files.jb51.net/file_images/article/201603/201603211609281.png[/img] [b]2.安装node[/b] 将下载的node进行安装如下图一步一步的安装 [img]http://files.jb51.net/file_images/article/201603/201603211609282.png[/img] [img]http://files.jb51.net/file_images/article/201603/201603211609293.png[/img] [img]http://files.jb51.net/file_images/article/201603/201603211609294.png[/img] [img]http://files.jb51.net/file_images/article/201603/201603211609295.png[/img] [img]http://files.jb51.net/file_images/article/201603/201603211609296.png[/img] [img]http://files.jb51.net/file_images/article/201603/201603211609297.png[/img] [b]3.安装后检测是否安装node成功[/b] 安装后会在window开始按钮有一个命令窗口 [img]http://files.jb51.net/file_images/article/201603/201603211609298.png[/img] 打开之后检测node版本 [img]http://files.jb51.net/file_images/article/201603/201603211609299.png[/img] [b]4.安装全局Express[/b] [img]http://files.jb51.net/file_images/article/201603/2016032116092910.png[/img] [b]5.检测Express是否安装成功[/b] [img]http://files.jb51.net/file_images/article/201603/2016032116092911.png[/img] [b]6.demo测试[/b] 1).创建helloWorld.js
var http = require("http");
 
http.createServer(function(request, response) {
 
response.writeHead(200, {"Content-Type": "text/plain"});
 
response.write("Hello World");
 
response.end();
 
}).listen(8899);
 
console.log("nodejs start listen 8899 port!");

2).将helloWorld.js放到F:\nodejs\node_modules\npm\test目录下 [img]http://files.jb51.net/file_images/article/201603/2016032116092912.png[/img] 3).启动输出 使用命令行指向helloWorld.js上一级目录,启动express [img]http://files.jb51.net/file_images/article/201603/2016032116092913.png[/img] 7. 运行结果 在浏览器输入http://127.0.0.1:8899,输出结果如下 [img]http://files.jb51.net/file_images/article/201603/2016032116092914.png[/img] 作者:巴黎欧莱雅 以上就是本文的全部内容,希望对大家的学习有所帮助。
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部