node.js 初体验
date:星期六, 三月 12th, 2011 at 3:31 上午 Categories:web
依据Google著名的开源JavaScript引擎V8来进行二次开发的Web I/O服务器(http://nodejs.org/)。V8本身是非常快的JavaScript引擎,处理JS执行运行的速度非常高。相关测试表明,FireFox、Opera和IE的JS引擎速度都不及V8来得快。而且,还可以说,只要浏览器之间的JS引擎大战一日不减,NodeJs就可以从中受益。有竞争才有进步:)。
以上简介 网络复制。。不介绍了
从官方 下载了NODE
./configure
make
make install
完成安装
其中需要安装libssl-dev
安装完后看下版本吧
yingouqlj@Compaq-321:~/temp/node-v0.4.2$ node -v
v0.4.2
第一次使用 当然尝试下helloworld
不知道 网上的都是0.2X 的版本还是 转载后 少了表单符号。。网上好多示例执行都有问题
剧烈 很多出现 res.close() 报错
或者在OSCHINA上看到的。 居然字符串都没有引号。
最后找到了官方正确的示例。对比下 没有那个出错的 RES。CLOSE
var sys=require('sys'),http=require('http'); var server=http.createServer(function(req,res){ res.writeHeader(200,{'Content-Type':'text/plain'}); res.end("hello world"); }) server.listen(7581,'127.0.0.1'); sys.puts("run");
保存 后运行 node 文件名
然后访问本地 127.0.0.1:7581
即可看到 HELLOWORLD
这些代码虽然都是网络复制的。。 但为什么网上很多都是报错的。。是因为版本吗?

2011.03.25 12:20 上午
Ubuntu下为了使用CoffeeScript安装了这个~
运行成功~
[Reply]
2012.02.18 1:38 上午
Today, considering the fast life-style that everyone leads, credit cards get this amazing demand throughout the market. Persons out of every discipline are using the credit card and people who aren’t using the credit card have prepared to apply for even one. Thanks for discussing your ideas on credit cards.
[Reply]