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
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
840
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
20260804_Q4AzureUpdateBite_FabricDataAgentの精度を高める設計.pdf
matayuuu
1
140
Agent 時代の Kaggle 展望 / kaggle-in-the-agentic-era
upura
1
780
Goでデータパイプラインを作ろう
sansantech
PRO
1
480
ソフトウェアサプライチェーンの構造的リスクとコンテナ環境の保護
kyohmizu
4
350
【CEDEC2026】次世代デジタルカードゲームのサーバー設計と運用 〜『Shadowverse: Worlds Beyond』の舞台裏~
cygames
PRO
1
1.4k
2026-08-15 JAWS-UG 茨城 #16 Secrets ManagerにおけるSecret値の管理(Terraformの場合) / Secrets Manager Secrets
masasuzu
0
160
私がブラウザを自作したくなった理由
supurazako
1
250
Genie Codeハンズオン応用編
taka_aki
0
110
つくって納得、つかって実感! 大規模言語モデルことはじめ ver2.0
recruitengineers
PRO
5
1.8k
猫付きpingコマンドを自作
uyuki234
0
250
グローバル基準のSREは、運用現場でどう機能したか:成熟度アセスメントの実践 / SRE NEXT 2026
sorawatanabe
0
280
制約理論(ToC)入門 2026版
recruitengineers
PRO
8
2.4k
Featured
See All Featured
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
470
AI: The stuff that nobody shows you
jnunemaker
PRO
9
920
How STYLIGHT went responsive
nonsquared
100
6.2k
Designing for humans not robots
tammielis
254
26k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.1k
So, you think you're a good person
axbom
PRO
2
2.1k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Ruling the World: When Life Gets Gamed
codingconduct
0
300
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
800
New Earth Scene 8
popppiees
3
2.5k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.7k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
350
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