Suche senden
Hochladen
Node js实践
•
72 gefällt mir
•
9,823 views
jay li
Folgen
Node.js实践
Weniger lesen
Mehr lesen
Melden
Teilen
Melden
Teilen
1 von 63
Jetzt herunterladen
Downloaden Sie, um offline zu lesen
Empfohlen
Future of NodeJS
Future of NodeJS
Sébastien Pertus
Let s Enjoy Node.js
Let s Enjoy Node.js
Fred Chien
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Edureka!
Fundamental of Node.JS - Internship Presentation - Week7
Fundamental of Node.JS - Internship Presentation - Week7
Devang Garach
Use Node.js to create a REST API
Use Node.js to create a REST API
Fabien Vauchelles
Node js introduction
Node js introduction
Joseph de Castelnau
(C)NodeJS
(C)NodeJS
Jackson Tian
Node.js and Ruby
Node.js and Ruby
Michael Bleigh
Empfohlen
Future of NodeJS
Future of NodeJS
Sébastien Pertus
Let s Enjoy Node.js
Let s Enjoy Node.js
Fred Chien
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Edureka!
Fundamental of Node.JS - Internship Presentation - Week7
Fundamental of Node.JS - Internship Presentation - Week7
Devang Garach
Use Node.js to create a REST API
Use Node.js to create a REST API
Fabien Vauchelles
Node js introduction
Node js introduction
Joseph de Castelnau
(C)NodeJS
(C)NodeJS
Jackson Tian
Node.js and Ruby
Node.js and Ruby
Michael Bleigh
Getting Started with MongoDB and Node.js
Getting Started with MongoDB and Node.js
Grant Goodale
Continuous Integration for front-end JavaScript
Continuous Integration for front-end JavaScript
Lars Thorup
Javascript Bundling and modularization
Javascript Bundling and modularization
stbaechler
System webpack-jspm
System webpack-jspm
Jesse Warden
Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?
Christian Joudrey
An Introduction of Node Package Manager (NPM)
An Introduction of Node Package Manager (NPM)
iFour Technolab Pvt. Ltd.
Nodejs presentation
Nodejs presentation
Arvind Devaraj
Module, AMD, RequireJS
Module, AMD, RequireJS
偉格 高
Ferrara Linux Day 2011
Ferrara Linux Day 2011
Gianluca Padovani
Meetup RomaJS - introduzione interattiva a Node.js - Luca Lanziani - Codemoti...
Meetup RomaJS - introduzione interattiva a Node.js - Luca Lanziani - Codemoti...
Codemotion
An introduction to Node.js application development
An introduction to Node.js application development
shelloidhq
3 Things Everyone Knows About Node JS That You Don't
3 Things Everyone Knows About Node JS That You Don't
F5 Buddy
NodeJS
NodeJS
Alok Guha
Grunt & Front-end Workflow
Grunt & Front-end Workflow
Pagepro
Introduction to node.js
Introduction to node.js
Dinesh U
Revealing ALLSTOCKER
Revealing ALLSTOCKER
Masashi Umezawa
Node js for beginners
Node js for beginners
Arjun Sreekumar
Compressed js with NodeJS & GruntJS
Compressed js with NodeJS & GruntJS
David Nguyen
Speed up your development environment PHP + Nginx + Fedora + PG
Speed up your development environment PHP + Nginx + Fedora + PG
Marcus Sá
NodeJS
NodeJS
Predhin Sapru
用十分鐘瞭解 陳鍾誠的程式設計課 (採用JavaScript + C的原因)
用十分鐘瞭解 陳鍾誠的程式設計課 (採用JavaScript + C的原因)
鍾誠 陳鍾誠
使用 ASP.NET 5 實戰開發雲端應用程式
使用 ASP.NET 5 實戰開發雲端應用程式
Will Huang
Weitere ähnliche Inhalte
Was ist angesagt?
Getting Started with MongoDB and Node.js
Getting Started with MongoDB and Node.js
Grant Goodale
Continuous Integration for front-end JavaScript
Continuous Integration for front-end JavaScript
Lars Thorup
Javascript Bundling and modularization
Javascript Bundling and modularization
stbaechler
System webpack-jspm
System webpack-jspm
Jesse Warden
Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?
Christian Joudrey
An Introduction of Node Package Manager (NPM)
An Introduction of Node Package Manager (NPM)
iFour Technolab Pvt. Ltd.
Nodejs presentation
Nodejs presentation
Arvind Devaraj
Module, AMD, RequireJS
Module, AMD, RequireJS
偉格 高
Ferrara Linux Day 2011
Ferrara Linux Day 2011
Gianluca Padovani
Meetup RomaJS - introduzione interattiva a Node.js - Luca Lanziani - Codemoti...
Meetup RomaJS - introduzione interattiva a Node.js - Luca Lanziani - Codemoti...
Codemotion
An introduction to Node.js application development
An introduction to Node.js application development
shelloidhq
3 Things Everyone Knows About Node JS That You Don't
3 Things Everyone Knows About Node JS That You Don't
F5 Buddy
NodeJS
NodeJS
Alok Guha
Grunt & Front-end Workflow
Grunt & Front-end Workflow
Pagepro
Introduction to node.js
Introduction to node.js
Dinesh U
Revealing ALLSTOCKER
Revealing ALLSTOCKER
Masashi Umezawa
Node js for beginners
Node js for beginners
Arjun Sreekumar
Compressed js with NodeJS & GruntJS
Compressed js with NodeJS & GruntJS
David Nguyen
Speed up your development environment PHP + Nginx + Fedora + PG
Speed up your development environment PHP + Nginx + Fedora + PG
Marcus Sá
NodeJS
NodeJS
Predhin Sapru
Was ist angesagt?
(20)
Getting Started with MongoDB and Node.js
Getting Started with MongoDB and Node.js
Continuous Integration for front-end JavaScript
Continuous Integration for front-end JavaScript
Javascript Bundling and modularization
Javascript Bundling and modularization
System webpack-jspm
System webpack-jspm
Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?
An Introduction of Node Package Manager (NPM)
An Introduction of Node Package Manager (NPM)
Nodejs presentation
Nodejs presentation
Module, AMD, RequireJS
Module, AMD, RequireJS
Ferrara Linux Day 2011
Ferrara Linux Day 2011
Meetup RomaJS - introduzione interattiva a Node.js - Luca Lanziani - Codemoti...
Meetup RomaJS - introduzione interattiva a Node.js - Luca Lanziani - Codemoti...
An introduction to Node.js application development
An introduction to Node.js application development
3 Things Everyone Knows About Node JS That You Don't
3 Things Everyone Knows About Node JS That You Don't
NodeJS
NodeJS
Grunt & Front-end Workflow
Grunt & Front-end Workflow
Introduction to node.js
Introduction to node.js
Revealing ALLSTOCKER
Revealing ALLSTOCKER
Node js for beginners
Node js for beginners
Compressed js with NodeJS & GruntJS
Compressed js with NodeJS & GruntJS
Speed up your development environment PHP + Nginx + Fedora + PG
Speed up your development environment PHP + Nginx + Fedora + PG
NodeJS
NodeJS
Andere mochten auch
用十分鐘瞭解 陳鍾誠的程式設計課 (採用JavaScript + C的原因)
用十分鐘瞭解 陳鍾誠的程式設計課 (採用JavaScript + C的原因)
鍾誠 陳鍾誠
使用 ASP.NET 5 實戰開發雲端應用程式
使用 ASP.NET 5 實戰開發雲端應用程式
Will Huang
Node.js從無到有 基本課程
Node.js從無到有 基本課程
Simon Su
Node.js 進攻桌面開發
Node.js 進攻桌面開發
Fred Chien
NodeJS基礎教學&簡介
NodeJS基礎教學&簡介
GO LL
Modern UI Development With Node.js
Modern UI Development With Node.js
Ryan Anklam
Node Foundation Membership Overview 20160907
Node Foundation Membership Overview 20160907
NodejsFoundation
The Enterprise Case for Node.js
The Enterprise Case for Node.js
NodejsFoundation
Andere mochten auch
(8)
用十分鐘瞭解 陳鍾誠的程式設計課 (採用JavaScript + C的原因)
用十分鐘瞭解 陳鍾誠的程式設計課 (採用JavaScript + C的原因)
使用 ASP.NET 5 實戰開發雲端應用程式
使用 ASP.NET 5 實戰開發雲端應用程式
Node.js從無到有 基本課程
Node.js從無到有 基本課程
Node.js 進攻桌面開發
Node.js 進攻桌面開發
NodeJS基礎教學&簡介
NodeJS基礎教學&簡介
Modern UI Development With Node.js
Modern UI Development With Node.js
Node Foundation Membership Overview 20160907
Node Foundation Membership Overview 20160907
The Enterprise Case for Node.js
The Enterprise Case for Node.js
Ähnlich wie Node js实践
Let's run JavaScript Everywhere
Let's run JavaScript Everywhere
Tom Croucher
Nodejs a-practical-introduction-oredev
Nodejs a-practical-introduction-oredev
Felix Geisendörfer
Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS
drupalcampest
Node js quick-tour_v2
Node js quick-tour_v2
http403
Node js quick tour v2
Node js quick tour v2
Wyatt Fang
Node js quick-tour_v2
Node js quick-tour_v2
tianyi5212222
Server Side JavaScript - You ain't seen nothing yet
Server Side JavaScript - You ain't seen nothing yet
Tom Croucher
Node.js: The What, The How and The When
Node.js: The What, The How and The When
FITC
introduction to node.js
introduction to node.js
orkaplan
Server-Side JavaScript Developement - Node.JS Quick Tour
Server-Side JavaScript Developement - Node.JS Quick Tour
q3boy
OSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js Tutorial
Tom Croucher
Running YUI 3 on Node.js - JSConf 2010
Running YUI 3 on Node.js - JSConf 2010
Adam Moore
Node.js - A practical introduction (v2)
Node.js - A practical introduction (v2)
Felix Geisendörfer
Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.js
async_io
JavaScript is the new black - Why Node.js is going to rock your world - Web 2...
JavaScript is the new black - Why Node.js is going to rock your world - Web 2...
Tom Croucher
Introduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azure
Colin Mackay
Running YUI 3 on Node.js - BayJax
Running YUI 3 on Node.js - BayJax
Adam Moore
Groovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentation
Stuart (Pid) Williams
Практики применения JRuby
Практики применения JRuby
.toster
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.js
soft-shake.ch
Ähnlich wie Node js实践
(20)
Let's run JavaScript Everywhere
Let's run JavaScript Everywhere
Nodejs a-practical-introduction-oredev
Nodejs a-practical-introduction-oredev
Developing realtime apps with Drupal and NodeJS
Developing realtime apps with Drupal and NodeJS
Node js quick-tour_v2
Node js quick-tour_v2
Node js quick tour v2
Node js quick tour v2
Node js quick-tour_v2
Node js quick-tour_v2
Server Side JavaScript - You ain't seen nothing yet
Server Side JavaScript - You ain't seen nothing yet
Node.js: The What, The How and The When
Node.js: The What, The How and The When
introduction to node.js
introduction to node.js
Server-Side JavaScript Developement - Node.JS Quick Tour
Server-Side JavaScript Developement - Node.JS Quick Tour
OSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js Tutorial
Running YUI 3 on Node.js - JSConf 2010
Running YUI 3 on Node.js - JSConf 2010
Node.js - A practical introduction (v2)
Node.js - A practical introduction (v2)
Practical Use of MongoDB for Node.js
Practical Use of MongoDB for Node.js
JavaScript is the new black - Why Node.js is going to rock your world - Web 2...
JavaScript is the new black - Why Node.js is going to rock your world - Web 2...
Introduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azure
Running YUI 3 on Node.js - BayJax
Running YUI 3 on Node.js - BayJax
Groovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentation
Практики применения JRuby
Практики применения JRuby
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.js
Mehr von jay li
犀牛书第六版
犀牛书第六版
jay li
淘宝移动端Web开发最佳实践
淘宝移动端Web开发最佳实践
jay li
Jswebapps
Jswebapps
jay li
潜力无限的编程语言Javascript
潜力无限的编程语言Javascript
jay li
Responsive Web UI Design
Responsive Web UI Design
jay li
深入剖析浏览器
深入剖析浏览器
jay li
HTML/CSS/JS基础
HTML/CSS/JS基础
jay li
淘宝前端技术巡礼
淘宝前端技术巡礼
jay li
F2e security
F2e security
jay li
中国元素在设计中的应用 -如瑟
中国元素在设计中的应用 -如瑟
jay li
卫银霞 -统计数字会撒谎
卫银霞 -统计数字会撒谎
jay li
编码大全 拔赤
编码大全 拔赤
jay li
小控件、大学问
小控件、大学问
jay li
Mobile UI design and Developer
Mobile UI design and Developer
jay li
Javascript autoload
Javascript autoload
jay li
Html5form
Html5form
jay li
Slide
Slide
jay li
Js doc toolkit
Js doc toolkit
jay li
新业务新员工培训 Banner设计
新业务新员工培训 Banner设计
jay li
夏之 专题设计
夏之 专题设计
jay li
Mehr von jay li
(20)
犀牛书第六版
犀牛书第六版
淘宝移动端Web开发最佳实践
淘宝移动端Web开发最佳实践
Jswebapps
Jswebapps
潜力无限的编程语言Javascript
潜力无限的编程语言Javascript
Responsive Web UI Design
Responsive Web UI Design
深入剖析浏览器
深入剖析浏览器
HTML/CSS/JS基础
HTML/CSS/JS基础
淘宝前端技术巡礼
淘宝前端技术巡礼
F2e security
F2e security
中国元素在设计中的应用 -如瑟
中国元素在设计中的应用 -如瑟
卫银霞 -统计数字会撒谎
卫银霞 -统计数字会撒谎
编码大全 拔赤
编码大全 拔赤
小控件、大学问
小控件、大学问
Mobile UI design and Developer
Mobile UI design and Developer
Javascript autoload
Javascript autoload
Html5form
Html5form
Slide
Slide
Js doc toolkit
Js doc toolkit
新业务新员工培训 Banner设计
新业务新员工培训 Banner设计
夏之 专题设计
夏之 专题设计
Node js实践
1.
Node.js 实践 拔赤 bachi@taobao.com http://jayli.github.com
2010-10-28
2.
NodeJS 初体验:瘦身,速度,灵活,帅!
3.
•
JavaScript之初 • WebServer之初 • NodeJS • JavaScript的优异表现 • 更进一步:DOM&YUI3
4.
• JavaScript之初 •
WebServer之初 • NodeJS • JavaScript的优异表现 • 更进一步:DOM&YUI3
5.
JavaScript诞生离不开 NetscapeNavigator
6.
ECMAScript一统江湖
JavaScript ActionScript ScriptEase …
7.
我们熟悉的JavaScript
ECMAScript DOM BOM JS库(jQuery,YUI,prototype…)
8.
JS在客户端表现优异,但是…
9.
浏览器弱小的权限限制了JS的表现
10.
• JavaScript之初 • WebServer之初 •
NodeJS • JavaScript的优异表现 • 更进一步:DOM&YUI3
11.
WebServer • Web服务(Apache/IIS/JBoss)
– 处理请求、线程、IO… • 语言引擎(php/Asp/Java) – 面向开发者
12.
WebServer • Web服务(Apache/IIS/JBoss)
– 处理请求、线程、IO… • 语言引擎 (php/Asp/Java/JavaScript) – 面向开发者
13.
http://jaxer.org/ https://developer.mozilla.org/En/JavaScript/Server-
Side_JavaScript/Walkthrough WebServer+SpiderMonkey
14.
浏览器渲染DOM的部分工作分担到服务器
15.
• JavaScript之初 • WebServer之初 •
NodeJS • JavaScript的优异表现 • 更进一步:DOM&YUI3
16.
http://nodejs.org/ http://github.com/ry/node
17.
RyanDahl http://github.com/ry Video: http://www.yuiblog.com/blog/2010/05/20/video-dahl/
18.
Why? Node'sgoalistoprovideaneasyway tobuildscalablenetworkprograms.
-- RyanDahl
19.
NodeJS的实现 •
单线程 (single-thread) • 非阻塞式IO (non-blocking) • V8 • 事件驱动 (event-based)
20.
• 单线程:多个请求占用一个线程 • 多线程:一个请求占用一个线程 (Web服务的)单线程
vs多线程
21.
单线程的性能优势 Nginx(单线程)vsApache(多线程)
22.
/* 阻塞 */ get_a_request();
//从队列中得到一个请求 handle_request(); //处理这个请求 feedback(); //返回处理结果 get_another_request(); //从队列中获得下一个请求 ... /* 非阻塞 */ get_a_request(); //得到一个请求 handle_request(function(){ //处理这个请求 feedback(); //等到处理完成后,返回处理结果 }); get_another_request(); //从队列中获得下一个请求 ... 阻塞 vs非阻塞
23.
非阻塞的性能优势 Nginx(非阻塞)vsApache(阻塞)
24.
“瘦身”带来的性能优势 高并发数的响应时间
25.
“瘦身”带来的性能优势 续
大尺寸文件的响应时间
26.
让人垂涎的长连接 过去/现在/将来
27.
完美的单线程?
28.
单线程的先天不足 • 操控多CPU的短板 –
单线程程序只能在一个CPU上运行 • 可靠性!? – 一个异常影响整个线程
29.
NodeJS的取舍 单线程,可靠性低,性能高 多线程,可靠性高,性能低
30.
JavaScript语言解释器 •
V8(Google)C++ • SpiderMonkey(Mozilla)C++ • Rhino(Mozilla)Java • JavaScriptCore(Apple)C++ • …
31.
NodeJS的选择 http://code.google.com/p/v8/
32.
NodeJS的事件驱动
33.
回调函数,等待“事件”发生
34.
/* NodeJS中的事件驱动 */ var
s = require("tcp").createServer(); s.addListener("connection",function(c){ c.send('hello jayli!'); c.close(); }); s.listen(8080); NodeJS中的事件驱动
35.
关键词 •
SSJS(Server-sideJavaScript) • 单线程 (Single-thread) • 非阻塞 (non-blocking) • 长连接 (persistentconnection) • V8 • 事件驱动 (Event-based)
36.
• JavaScript之初 • WebServer之初 •
NodeJS • JavaScript的优异表现 • 更进一步:DOM&YUI3
37.
NodeJS 优秀的基础架构 给了 JavaScript更多表现空间
38.
NodeJS带来了… •
SSJS没有“夸浏览器”的烦恼 • DOM、BOM的完整支持 • jQuery和YUI3完全成为“中间件” • js程序可以无缝移植到服务器端 • …
39.
NodeJS的运行环境
40.
“Helloworld” /* example.js*/ var http
= require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello Worldn'); }).listen(8124, "127.0.0.1"); 命令行运行 $ node example.js
41.
NodeJS的安装 wget http://nodejs.org/dist/node-v0.3.0.tar.gz tar xzvf
node-v0.3.0.tar.gz cd node-v0.3.0 ./configure make make install 查看版本 运行程序
42.
NodeJS程序/软件包
http://npmjs.org/
43.
和Python、Ruby一样 NodeJS也需要库的支持
44.
Ryan对http的初级封装 //引入库 var fu =
require("./fu"); //打开监听 fu.listen(PORT,HOST); //响应对path_to_file的请求 fu.get('path_to_file',callback); //请求静态文件 fu.staticHandler('filename'); //返回404 notFound(req,res); http://github.com/ry/node_chat/blob/master/fu.js
45.
NodeJSDemos http://github.com/ry/node/wiki
46.
•
JavaScript之初 • WebServer之初 • NodeJS • JavaScript的优异表现 • 更进一步:DOM & YUI3
47.
NodeJS如何渲染HTML http://github.com/tmpvar/jsdom
http://github.com/tautologistics/node- htmlparser
48.
NodeJS运行 jQuery var jsdom
= require("jsdom"), window = jsdom.jsdom().createWindow(); jsdom.jQueryify(window, "http://cdn/jquery.js" , function() { window.jQuery('body').append(<div class='testing'>Hello World, It works</div>"); console.log(window.jQuery(".testing") .text()); } );
49.
nodejs-dom提供了 • DOM常规操作
• 选择器 • YUINodeAPI
50.
YUI3 •
高粒度的模块 • 沙箱 • 组件异步加载 • core+widgets • 不只为DOM而设计 -- RyanDahl
51.
YUI3forNodeJS http://github.com/yui/nodejs-yui3
52.
DavGlass nodejs-yui3项目发起人
UsingNode.jsandYUI3 http://www.yuiblog.com/blog/2010/09/29/video- glass-node/
53.
启动你的YUI程序 var YUI =
require("yui3").YUI, Y = YUI(); Y.log('hello world'); 运行
54.
熟悉的沙箱 var YUI =
require("yui3").YUI; YUI().use('*',function(Y){ Y.log('hello jayli!'); }); 运行
55.
移植YUI3程序 – 后端渲染UI •
SourceCode – http://jayli.github.com/gallery/node/calendar-server.js • 前端Demo – http://cubee.github.com/src/calendar/demo/calendar.html
56.
移植YUI3程序 – 后端渲染UI&交互
• SourceCode – http://jayli.github.com/gallery/node/pagination-server.js • 前端Demo – http://cubee.github.com/src/pagination/demo/pagination.html
57.
YUI2Calendar
后端渲染UI&交互 http://express.davglass.com/calendar
58.
WhyYUI3? • YUI3的设计使其很方便的移植到NodeJS • YUI3在NodeJS中同样提供完整的core •
一次编写,前/后端运行,cool!
59.
WhataboutKISSY? •
和YUI3极为相似的沙箱 • 核心模块更充分的解耦 • 更粗粒度的组件 • …
60.
KISSYforNodeJS http://github.com/jayli/nodejs-kissy
61.
启动你的KISSY程序 require("yui3").YUI; Var S =
KISSY; S.use("ks-core",function(S){ S.log("hello world"); }). 运行
62.
相关链接 • NodeJS
– http://nodejs.org • YUI3 – http://developer.yahoo.com/yui/3/ • Nodejs-yui – http://github.com/yui/nodejs-yui3 • Npm – http://npmjs.org • Nodejs-kissy – http://github.com/jayli/nodejs-kiss
63.
Q&A
Jetzt herunterladen