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
Domains in node 0.8
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Felix Geisendörfer
June 29, 2012
Technology
5.6k
8
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Domains in node 0.8
A quick presentation I gave at HolidayExtras on using the new domain feature in node.js 0.8.
Felix Geisendörfer
June 29, 2012
More Decks by Felix Geisendörfer
See All by Felix Geisendörfer
tus.io - Resumable File Uploads (Lightning Talk)
felixge
2
850
Programming flying robots with JavaScript
felixge
2
1k
Programming flying robots with JavaScript
felixge
0
660
Programming an AR Drone Firmware with JS (de)
felixge
1
670
Faster than C?
felixge
1
1.3k
Flying robots over a 10.000 mile distance with JavaScript.
felixge
0
560
Faster than C?
felixge
1
710
The power of node.js (with quadcopters)
felixge
0
550
Faster than C?
felixge
0
490
Other Decks in Technology
See All in Technology
AI駆動開発はどこまで来たのか? ファインディの最新実態調査で読み解く現在地 Devin Con Tokyo
akiratom
4
1.9k
パスキーでドライブする アカウント統合(OAuth/OIDC Numa (Immersion) Workshop 2026)
oidfj
PRO
0
360
暗号化?某ファイルストレージはどうなるの!? 3rd Partyとうまく付き合う秘密度ラベル設計
kasada
0
210
サイボウズ 開発本部採用ピッチ / Cybozu Engineer Recruit
cybozuinsideout
PRO
12
86k
Claude Codeの体系的な理解と知識のフック
oikon48
8
6k
全社に広がるMCPサーバーを、 どう安全に管理するか MCPass開発の舞台裏
mtpooh
3
180
サービス内で複数のOP・ASを連鎖させる(OAuth/OIDC Numa (Immersion) Workshop 2026)
oidfj
PRO
0
350
Cloudflare製品を活用した AIガバナンス実践入門 / AI governance with Cloudflare Service
delta_tech
1
120
エージェント化するAI:現在地とその先に起きる変化 / AI as Agents: The Current State and the Changes Ahead
ks91
PRO
0
160
現場の暗黙知を継承するAIエージェント — 対話から生まれる長期記憶と Skills
atsukish
0
130
医療の現場を変革に挑戦した半年間の軌跡 - PythonとAIで現場を変える / From Code to Care
soudai
PRO
1
640
[RSJ26] Flow as Flow: Modeling Robot Velocity Fields as Probability Velocity Fields
keio_smilab
PRO
0
110
Featured
See All Featured
SEO for Brand Visibility & Recognition
aleyda
0
4.7k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.8k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.6k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
370
Odyssey Design
rkendrick25
PRO
2
780
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
410
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.1k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
250
Transcript
Domains in node 0.8 A quick introduction Freitag, 29. Juni
12
1 var app = require('express')(); 2 3 app.get('/search', function(req, res,
next) { 4 doSearch(req.params, function(err, result) { 5 if (err) return next(err); 6 7 // trying to access non-existing property 8 if (result.foo.bar) { 9 console.log('does not work'); 10 } 11 }); 12 }); 13 14 app.listen(8080); Freitag, 29. Juni 12
/Users/Felix/Desktop/domains/example.js:14 if (result.foo.bar) { ^ TypeError: Cannot read property 'bar'
of undefined at /Users/Felix/Desktop/domains/example.js:14:19 at doSearch (/Users/Felix/Desktop/domains/example.js:3:5) at process.startup.processNextTick.process._tickCallback (node.js:244:9) Freitag, 29. Juni 12
1 process.on('uncaughtException', function(err) { 2 // Keeps the process from
crashing 3 // But does not let you find out which `req` 4 // was causing the `err` 5 }); Freitag, 29. Juni 12
Domains to the rescue! Freitag, 29. Juni 12
1 var createDomain = require('domain').create; 2 3 app.use(function(req, res, next)
{ 4 var domain = createDomain(); 5 6 domain.on('error', function(err) { 7 // alternative: next(err) 8 res.statusCode = 500; 9 res.end(err.message + '\n'); 10 11 domain.dispose(); 12 }); 13 14 domain.enter(); 15 next(); 16 }); Freitag, 29. Juni 12
$ curl -i localhost:8080/search HTTP/1.1 500 Internal Server Error X-Powered-By:
Express Date: Fri, 29 Jun 2012 10:50:18 GMT Connection: keep-alive Transfer-Encoding: chunked Cannot read property 'bar' of undefined Freitag, 29. Juni 12
Questions? Freitag, 29. Juni 12
Hiring node.js developers @ marcgreenstock @dan_jenkins Freitag, 29. Juni 12