Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Node.js那些事儿

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.

 Node.js那些事儿

课题分享

Avatar for Allen Liu

Allen Liu

May 27, 2012
Tweet

More Decks by Allen Liu

Other Decks in Programming

Transcript

  1. 4 是什么? ➢ 学名: Node.js ➢ 辟谣:核心由 C/C++ 编写 ➢

    本质:一个 JavaScript 虚拟机 ➢ 托管: https://github.com/joyent/node ➢ 概括: evented I/O for v8 javascript
  2. 8 Node.js VS Apache+mod_php ➢ 独立完成 VS 细化分工 ➢ 面向事件编程

    VS 面向对象编程 ➢ 英雄主义 VS 人海战术 ➢ 劳模 VS 普通青年
  3. npm ➢ Node Package Manager ➢ pear 、 gem 、

    apt ➢ curl http://npmjs.org/install.sh | sudo sh
  4. CommonJS ➢ 它是一套 API 。 ➢ 它要为 Web 服务器 ,

    桌面和命令行应用创 建一个完整的 JavaScript 生态系统,不 仅仅只为浏览器。 ➢ 它定义了一组标准和规范,如模块、包、 文件系统等。
  5. 代码示例 ➢ 功能:根据坐标获取小区列表的 API 。 ➢ 方式: POST ➢ 返回:

    JSON ➢ 测试: ab -c 100 -n 1000 ➢ 网址: https://github.com/liuxd/MyNodeJS
  6. 22 谁在用? ➢ Instagram—— 基于 Node.js 开发了 node2dm ➢ LinkedIn——

    移动应用业务 ➢ Github——NodeLoad, 存档下载服务器 ➢ —— 淘宝 用 Node.js 实现 MyFOX ➢ 微软、雅虎、 ebay
  7. 23 By the way ➢ NAE——Node App Engine ➢ http://registry.npmjs.vitecho.com

    ➢ npm config set registry “XXOO” ➢ PHP 版的 Node.js——React