Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
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
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
680
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
720
The power of node.js (with quadcopters)
felixge
0
560
Faster than C?
felixge
0
490
Other Decks in Technology
See All in Technology
おい、エージェントを使って終わらせろ
nwiizo
1
650
生成AIエージェントを用いた、 手動テスト手順書から自動テストへの 変換手法の検討
magicpod
0
160
映像変換サーバーなしで端末内でHLSを生成してライブ配信
hikarusato
0
120
すぐできる衛星通信対応 あとは山奥に行くだけ
tatetate55
0
130
現場で役立つ技術負債の効果的な返済方法
masuda220
PRO
9
4.5k
研究開発部の紹介 / Sansan R&D Profile
sansan33
PRO
5
25k
SREへの勘違いに気づいた後の話
tomodakengo
0
100
beyond jj: config & tools ecosystem
indirect
0
3.3k
事業課題から技術的負債に向き合う
sansantech
PRO
2
1.9k
越境するなら専門用語を使うな高校校歌 / If you wanna cross border, you shouldn't use jargon
vtryo
0
140
AI 時代のスタートアップエコシステ厶から考究する技術的負債との向き合い方
m3m0r7
PRO
3
2.2k
AIエージェントを最高のパートナーに育てる方法|評価と判断軸を育てる5つのステップ
koichiaoki
1
150
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.6k
For a Future-Friendly Web
brad_frost
183
10k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
470
Writing Fast Ruby
sferik
630
63k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
280
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.4k
Context Engineering - Making Every Token Count
addyosmani
9
1.1k
How STYLIGHT went responsive
nonsquared
100
6.3k
The Invisible Side of Design
smashingmag
301
52k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
730
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
340
Large-scale JavaScript Application Architecture
addyosmani
515
110k
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