想学Node.js很久了,一直没有契机,这次避不开了。
# 编译Node.js
## Node.js&NPM
package.json
{ "name": "test", "version": "1.0.0", "description": "A testing package", "author": "piaoger", "dependencies": { "express": "1.x.x", "redis": ">= 0.6.7" }, "scripts": { "start": "node runner.js", }, "config": { "key":"123456" }, "engines": { "node": "0.4.x" } }
我们可以用npm_package_config_XXX的方式来读取package.json中的设置,如用env.npm_package_config_key来获得key的值。
## The first Example
这个例子是一个Server端运行的JavaScript。
利用Node.js的http模块创建了一个HTTP Server,然后在handleRequest中处理Http Request。
// server.js
function handleRequest(request, response) { response.writeHead(200, {"Content-Type": "text/plain"}); response.write("Hello Node.js"); response.end(); }; var http = require("http"); http.createServer(handleRequest).listen(8888);
有了上面的server.js,我们只需要Node.js执行这个脚本即可
S:\Web\node\bin>node S:\Web\server\web\test\server.js
然后,我们可以在浏览器中地址栏输入 http://localhost:8888/,显示结果为"Hello Node.js".
## express.js
## Node.js调试
暂时只是用过Eclipse来做这个事情
## WebSocket (socket.io)
## Node.js C++ addon
## JavaScript Module
# Reference
[在Windows平台上安装Node.js及NPM模块管理] (http://www.cnblogs.com/seanlv/archive/2011/11/22/2258716.html)
[Node.js与Tornado,两个无阻塞的WebServer] (http://www.cnblogs.com/piaoger/archive/2012/05/09/2491236.html)
[Nodejs调试技术总结] (http://www.cnblogs.com/moonz-wu/archive/2012/01/15/2322120.html)
[Node Beginner] (http://www.nodebeginner.org/index-zh-cn.html#server-side-javascript)
[认识HTML5的WebSocket] (http://www.cnblogs.com/wei2yi/archive/2011/03/23/1992830.html)
[Google Chrome Developer Tools for Java] (http://code.google.com/p/chromedevtools/)
[Node.js的HelloWorld!] (http://www.cnblogs.com/otlive/archive/2012/03/03/2378796.html)
[Node CPP Modules] (http://kkaefer.github.com/node-cpp-modules)
[How to module] (http://howtonode.org/how-to-module)
[How to roll out your own Javascript API with V8] (http://syskall.com/how-to-roll-out-your-own-javascript-api-with)
[How to write your own native Node.js extension] (http://syskall.com/how-to-write-your-own-native-nodejs-extension)
[Writing node.js Native Extensions] (https://www.cloudkick.com/blog/2010/aug/23/writing-nodejs-native-extensions)
[编写Node.js原生扩展] (http://www.grati.org/?p=413)
[在Windows下编译安装Node.js和开发C/C++原生扩展] (http://cnodejs.org/topic/4f71e3688a04d82a3d264b5a)
[Building a Node.js Windows C++ Addon] (http://coderesearchlabs.com/articles/BNWCA.pdf)
[WebSocket++] (http://www.zaphoyd.com/websocketpp)
[Nodejs+express 实战,实现系统监控功能] (http://www.cnblogs.com/fullhouse/archive/2011/07/18/2109963.html)
[使用 Node.js 作为完整的云环境开发堆栈] (http://www.oschina.net/question/129540_25033)
[Using Node.js to download files] (http://www.hacksparrow.com/using-node-js-to-download-files.html)
[Node fibers] (https://github.com/laverdet/node-fibers)
[Node png] (https://github.com/pkrumins/node-png)
[Node代码初探] (http://cnodejs.org/topic/4f571a16a680d212781ccf9f)
[用V8打造自己的脚本引擎] (http://www.jybase.net/wangzhananquan/20111030517.html)
[] (http://kkaefer.github.com/node-cpp-modules/#node-sqlite3-no-close)
http://rezoner.net/how-to-send-and-receive-binary-data-over-websockets,4
http://stackoverflow.com/questions/6869926/websockets-and-binary-data
http://www.websector.de/blog/2011/12/22/pushing-binary-image-data-using-node-js-and-socket-io/
Module:
http://www.cnblogs.com/rubylouvre/archive/2012/08/21/2648067.html
http://knockoutjs.com/documentation/introduction.html
https://github.com/dschnare/xport/blob/master/main.js
http://www.hacksparrow.com/node-js-exports-vs-module-exports.html
http://zihua.li/2012/03/use-module-exports-or-exports-in-node/
[NPM Tricks] (http://www.devthought.com/2012/02/17/npm-tricks/)
http://blog.rstack.cc/