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
300
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
Go を使い始めて 2 ヶ月の学び / My first two months with Go
contour_gara
0
380
React本体のコードリーディング
high_g_engineer
1
160
源内ハンズオン概要編
hideg
0
210
仕様駆動開発の消費期限
watany
20
9k
ドリフトを絶対に許さない(?)CDK運用 / CDK Ops with Zero Tolerance for Drifts (?)
akihisaikeda
1
230
属人化した知識を、 AIが辿れる地図にする
pkshadeck
PRO
1
210
Flow は今どうなっているか
mizdra
PRO
0
720
Loosening the Reins: Go Generics Get More Flexible
kuro_kurorrr
0
330
ソフトウェアラスタライザ
fadis
1
660
信頼性の目標を誰も求めてない
shubox
0
110
typoなんかねぇよ
raspython3
0
550
「つくるAI」だけではバグは見つからない ~テストに必要な「見つけるAI」を分離させる戦略~
mfunaki
0
180
Featured
See All Featured
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
280
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.8k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Designing for humans not robots
tammielis
254
26k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
180
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.1k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.7k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
Chasing Engaging Ingredients in Design
codingconduct
0
280
Believing is Seeing
oripsolob
1
200
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
220
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