Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Introduction to Node and its Core Modules
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
aryoung
February 06, 2013
Programming
290
3
Share
Introduction to Node and its Core Modules
From
http://bathcamp.org/
, February 6th 2013
aryoung
February 06, 2013
More Decks by aryoung
See All by aryoung
Vim and the Web
aryoung
0
7.8k
Tern for Vim
aryoung
2
1.7k
Vim London: Custom Motions
aryoung
6
3.8k
Other Decks in Programming
See All in Programming
Building on Bluesky's AT Protocol with Ruby
mackuba
0
110
認証統合から始めるフロントエンドの機能単位開発 — マイクロサービス思想の適用
koukimiura
0
100
AI-DLC Deep Dive
yuukiyo
9
5.6k
Cache-moi si tu peux : patterns et pièges du cache en production - Devoxx France 2026 - Conférence
slecache
0
340
Lightning-Fast Method Calls with Ruby 4.1 ZJIT / RubyKaigi 2026
k0kubun
3
2.6k
(Re)make Regexp in Ruby: Democratizing internals for the JIT
makenowjust
3
1k
PHPでバイナリをパースして理解するASN.1
muno92
PRO
0
430
Claude Code × Gemini × Ebitengine ゲーム制作素人WebエンジニアがGoでゲームを作った話
webzawa
0
220
AI時代のエンジニアリングの原則 / Engineering Principles in the AI Era
haru860
0
1.1k
Spec Driven Development | AI Summit Vilnius
danielsogl
PRO
1
140
PHPでローカル環境用のSSL/TLS証明書を発行することはできるのか? #phpconkagawa
akase244
0
350
検索設計から 推論設計への重心移動と Recall-First Retrieval
po3rin
5
1.6k
Featured
See All Featured
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Optimising Largest Contentful Paint
csswizardry
37
3.7k
30 Presentation Tips
portentint
PRO
1
290
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.9k
Amusing Abliteration
ianozsvald
1
160
Discover your Explorer Soul
emna__ayadi
2
1.1k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
The Language of Interfaces
destraynor
162
26k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.1k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
160
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.2k
Transcript
Introduction to Node Alex
Overview ‣ Brief
5 Years Ago... ‣ We
Thursday, 7 February 13
A
Node’s Strengths ‣ Network-oriented
Installation ‣ Wizards
Runtime Environment ‣ Every
Modules ‣ CommonJS
Core Modules ‣ Events,
"Node's
Why Bother? ‣ Events/streams
Streams var zlib = require('zlib').createGzip(); var fs = require('fs'); var
inp = fs.createReadStream('input.txt'); var out = fs.createWriteStream('output.txt.gz'); inp.pipe(gzip).pipe(out); Clean,
Events var util = require('util'); var events = require('events'); function
Player() { events.EventEmitter.call(this); } util.inherits(Player, events.EventEmitter); var player = new Player(); player.on('play', function(track) { console.log('[NP]:', track.title); }); player.emit('play', { title: 'Spit On A Stranger', artist: 'Pavement' }); Thursday, 7 February 13
Servers var net = require('net'); var server = net.createServer(function(c) {
console.log('server connected'); c.on('end', function() { console.log('server disconnected'); }); c.write('hello\r\n'); c.pipe(c); }); server.listen(8124, function() { //'listening' listener console.log('server bound'); }); Thursday, 7 February 13
HTTP Server var http = require('http'); var fs = require('fs');
http.createServer(function(req, res) { fs.readFile(__dirname + 'index.html', function(err, data) { if (err) { res.statusCode = 500; res.end(String(err)); } else { res.end(data); } }); }).listen(8000); Thursday, 7 February 13
HTTP Server var http = require('http'); var fs = require('fs');
http.createServer(function(req, res) { fs.readFile(__dirname + 'index.html', function(err, data) { if (err) { res.statusCode = 500; res.end(String(err)); } else { res.end(data); } }); }).listen(8000); Thursday, 7 February 13
HTTP Server var http = require('http'); var fs = require('fs');
http.createServer(function(req, res) { fs.readFile(__dirname + 'index.html', function(err, data) { if (err) { res.statusCode = 500; res.end(String(err)); } else { res.end(data); } }); }).listen(8000); Thursday, 7 February 13
HTTP Server var http = require('http'); var fs = require('fs');
http.createServer(function(req, res) { fs.readFile(__dirname + 'index.html', function(err, data) { if (err) { res.statusCode = 500; res.end(String(err)); } else { res.end(data); } }); }).listen(8000); Not
Streams with HTTP var http = require('http'); var fs =
require('fs'); http.createServer(function(req, res) { var stream = fs.createReadStream('index.html'); stream.pipe(res); }).listen(8000); Thursday, 7 February 13
Gzip for Free var http = require('http'); var fs =
require('fs'); var zlib = require('zlib'); http.createServer(function(req, res) { var stream = fs.createReadStream('index.html'); res.writeHead(200, { 'content-encoding': 'gzip' }); stream.pipe(zlib.createGzip()).pipe(res); }).listen(8000); Thursday, 7 February 13
Gzip for Free var http = require('http'); var fs =
require('fs'); var zlib = require('zlib'); http.createServer(function(req, res) { var stream = fs.createReadStream('index.html'); res.writeHead(200, { 'content-encoding': 'gzip' }); stream.pipe(zlib.createGzip()).pipe(res); }).listen(8000); How
TO-DO: Learn
The End http://www.flickr.com/photos/dunechaser/6884829633/ Thursday, 7 February 13