Home
Explore
Submit Search
Upload
Login
Signup
Advertisement
Nodejs - A-quick-tour-v3
Report
Felix Geisendörfer
Follow
Chief Quality Enforcer at Debuggable Limited
Oct. 8, 2010
•
0 likes
7 likes
×
Be the first to like this
Show More
•
3,120 views
views
×
Total views
0
On Slideshare
0
From embeds
0
Number of embeds
0
Check these out next
Nodejs - A quick tour (v6)
Felix Geisendörfer
Node.js in production
Felix Geisendörfer
Node.js - A Quick Tour
Felix Geisendörfer
How to Test Asynchronous Code (v2)
Felix Geisendörfer
Deploying Plone and Volto, the Hard Way
Asko Soukka
Shell Tips & Tricks
MongoDB
A language for the Internet: Why JavaScript and Node.js is right for Internet...
Tom Croucher
Move Over, Rsync
All Things Open
1
of
36
Top clipped slide
Nodejs - A-quick-tour-v3
Oct. 8, 2010
•
0 likes
7 likes
×
Be the first to like this
Show More
•
3,120 views
views
×
Total views
0
On Slideshare
0
From embeds
0
Number of embeds
0
Download Now
Download to read offline
Report
Felix Geisendörfer
Follow
Chief Quality Enforcer at Debuggable Limited
Advertisement
Advertisement
Advertisement
Recommended
Nodejs - A quick tour (v4)
Felix Geisendörfer
4.6K views
•
50 slides
Nodejs - A quick tour (v5)
Felix Geisendörfer
2.8K views
•
58 slides
Nodejs - Should Ruby Developers Care?
Felix Geisendörfer
3.8K views
•
52 slides
Nodejs a-practical-introduction-oredev
Felix Geisendörfer
2.9K views
•
59 slides
Node.js - A practical introduction (v2)
Felix Geisendörfer
4.7K views
•
77 slides
Node.js - As a networking tool
Felix Geisendörfer
12.9K views
•
47 slides
More Related Content
Slideshows for you
(20)
Nodejs - A quick tour (v6)
Felix Geisendörfer
•
3.9K views
Node.js in production
Felix Geisendörfer
•
8.4K views
Node.js - A Quick Tour
Felix Geisendörfer
•
9.3K views
How to Test Asynchronous Code (v2)
Felix Geisendörfer
•
4.8K views
Deploying Plone and Volto, the Hard Way
Asko Soukka
•
221 views
Shell Tips & Tricks
MongoDB
•
1.4K views
A language for the Internet: Why JavaScript and Node.js is right for Internet...
Tom Croucher
•
9.4K views
Move Over, Rsync
All Things Open
•
613 views
MongoDB Shell Tips & Tricks
MongoDB
•
8.8K views
Redis - Usability and Use Cases
Fabrizio Farinacci
•
1.1K views
Building the Enterprise infrastructure with PostgreSQL as the basis for stori...
PavelKonotopov
•
110 views
Running High Performance & Fault-tolerant Elasticsearch Clusters on Docker
Sematext Group, Inc.
•
10.4K views
Introduction to NodeJS with LOLCats
Derek Anderson
•
1.2K views
MongoDB's New Aggregation framework
Chris Westin
•
18.6K views
Lua tech talk
Locaweb
•
2.3K views
Getting Started with MongoDB
Michael Redlich
•
2.1K views
Kicking ass with redis
Dvir Volk
•
39.1K views
Redis and its many use cases
Christian Joudrey
•
8.7K views
Declare your infrastructure: InfraKit, LinuxKit and Moby
Moby Project
•
2.6K views
Introduction to redis - version 2
Dvir Volk
•
9.8K views
Similar to Nodejs - A-quick-tour-v3
(20)
introduction to node.js
orkaplan
•
3.7K views
soft-shake.ch - Hands on Node.js
soft-shake.ch
•
2.3K views
Node.js: The What, The How and The When
FITC
•
4.6K views
Matthew Eernisse, NodeJs, .toster {webdev}
.toster
•
1.4K views
NodeJS
.toster
•
1.9K views
node.js: Javascript's in your backend
David Padbury
•
12.6K views
Writing robust Node.js applications
Tom Croucher
•
15.6K views
Building and Scaling Node.js Applications
Ohad Kravchick
•
1.7K views
Node.js introduction
Prasoon Kumar
•
1.5K views
Express Presentation
aaronheckmann
•
1K views
NodeJS for Beginner
Apaichon Punopas
•
14.8K views
Practical Use of MongoDB for Node.js
async_io
•
19.8K views
Node.js vs Play Framework
Yevgeniy Brikman
•
173.6K views
Java script at backend nodejs
Amit Thakkar
•
1.8K views
Let s Enjoy Node.js
Fred Chien
•
5.1K views
Nodejs Intro Part One
Budh Ram Gurung
•
2.9K views
Introduction to Node.js
Richard Lee
•
2K views
Original slides from Ryan Dahl's NodeJs intro talk
Aarti Parikh
•
2.1K views
Server side scripting smack down - Node.js vs PHP
Marc Gear
•
15.7K views
Node.js vs Play Framework (with Japanese subtitles)
Yevgeniy Brikman
•
42.5K views
Advertisement
Nodejs - A-quick-tour-v3
node.js A quick tour
(V3) 07.10.2010
About Contributor
Co-founder Felix Geisendörfer formidable node.js driver node.js file uploads
Audience?
JavaScript?
What is node?
Server side JavaScript $
git clone git://github.com/ry/node.git $ cd node $ ./configure $ make install
Server side JavaScript $
cat test.js console.log('Hello World'); $ node test.js Hello World
Server side JavaScript $
node > console.log('Hello World'); Hello World >
Ingredients
libeio libev c-ares V8 http_parser
Philosophy • Just enough
core-library to do I/O • Non-blocking • Close to the underlaying system calls
Benevolent Dictator For
Life Ryan Dahl
Concurrency Model
Non-blocking I/O var fs
= require('fs'); fs.readFile('test.txt', function(err, data) { if (err) throw err; console.log('Read file: ', data); }); console.log('Reading file ...');
Single Threaded var a
= []; function f() { a.push(1); a.push(2); } setTimeout(f, 10); setTimeout(f, 10);
API Overview
CommonJS Modules $ cat
hello.js exports.world = function() { return 'Hello World'; }; $ cat main.js var hello = require('./hello'); console.log(hello.world()); $ node main.js Hello World
Child processes $ cat
child.js var cmd = 'echo hello; sleep 1; echo world;', spawn = require('child_process').spawn, child = spawn('sh', ['-c', cmd]); child.stdout.on('data', function(chunk) { console.log(chunk.toString()); }); $ node child.js "hellon" # 1 sec delay "worldnn"
Http Server $ cat
http.js var http = require('http'); http.createServer(function(req, res) { setTimeout(function() { res.writeHead(200); res.end('Thanks for waiting!'); }, 1000); }).listen(4000); $ curl localhost:4000 # 1 sec delay Thanks for waiting!
Tcp Server $ cat
tcp.js var tcp = require('tcp'); tcp.createServer(function(socket) { socket.on('connect', function() { socket.write("Hi, How Are You?n> "); }); socket.on('data', function(data) { socket.write(data); }); }).listen(4000); $ nc localhost 4000 Hi, How Are You? > Great! Great!
DNS $ cat dns.js var
dns = require('dns'); dns.resolve('nodejs.org', function(err, addresses) { console.log(addresses); }); $ node dns.js [ '8.12.44.238' ]
Watch File $ cat
watch.js var fs = require('fs'); fs.watchFile(__filename, function() { console.log('You changed me!'); process.exit(0); }); $ node watch.js # edit watch.js You changed me!
And much more •
UDP • Buffer • Crypto • Script • Assert • EcmaScript5 ...
Suitable Applications • Web
frameworks • Real time • Crawlers
More Applications • Process
monitoring • File uploading • Streaming
Interesting projects
Package management
Web Frameworks • Express.js
(Sinatra clone) • Fab.js (Mind-bending & awesome)
DOM • jsdom • node-htmlparser •
apricot
WebSockets Socket.IO
Protocol parsers • node-formidable •
node-mysql
....
Limitations • Weak SSL
support • Weak Windows support • 1GB Heap limit on x64 (V8)
Hosting
Questions? ✎
@felixge / felix@debuggable.com
Questions? ✎
@felixge / felix@debuggable.com
Advertisement