【node.js学习】--(1)--HelloWord

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zhang__tianxu/article/details/43975791

今天练习了一个nodejs的入门案例,果然很轻量快速!


官网

http://nodejs.org/download/

下载

windows7 64位下载msi安装包:

http://nodejs.org/dist/v0.12.0/x64/node-v0.12.0-x64.msi


安装

一路狂点即可

安装到F盘F:\nodejs

执行普通JS

安装目录中新建

hello.js

console.log("hello world!");

进入安装目录执行nodehello.js,运行之后效果如下:

启动服务器运行js

新建http.js

var http = require("http");
http.createServer(function(request,response){
	response.writeHead(200,{"Content-Type","text/html"});
	response.write("Hello World!");
	response.end();
}).listen(8000);

运行


在浏览器输入

http://localhost:8000/则运行效果如图所示:


参考

http://www.cnblogs.com/jununx/p/3369781.html

http://nodejs.org/download/

猜你喜欢

转载自blog.csdn.net/zhang__tianxu/article/details/43975791