SlideShare a Scribd company logo
Modern Server Side
Development with NodeJS
What changed since the 0.10 days
Benjamin Gruenbaum
Benjamin Gruenbaum
• I work @ TipRanks
• NodeJS core collaborator.
• Promises guy, bluebird fan and core contributor.
• I argue with people online.
• StackOverflow guy.
This talk is in 3 parts
The Past
The Present
The Future
Let’s go back to 2009
JavaScript on the Server
JavaScript on the server is an
old idea
Netscape Enterprise Server – 1995
Steve Yegge’s Server – 2008
JavaScript on the server is a
good idea?
Remember, 2008- JavaScript engines are painfully slow.
APIs were nonexistent.
Language was hated.
Suddenly – V8
Google needed fast JavaScript in Chrome –
so JavaScript engines became fast.
This Ryan guy thought… let’s
make a non-blocking server.
As in – no thread “block”s in the user server code.
What can we write this in?
We need a language that doesn’t have file/net APIs yet to get a sane
ecosystem.
JavaScript has no blocking
APIs
The Result –
solving “The 10K Problem”
How: The Event Loop
Threads and OS non-blocking APIs push things into queues
User code runs on a single thread and executes handlers on the queues
Why even write node?
It’s fast enough.
Why even write node?
Server and client in one language
Why even write node?
It was cool
Remember: in 2009 JS is all the hotness
Code Sample: Chat Server
net.createServer(function(socket) {
var user = users.add(socket)
socket.on('data', function(data) { <- Callback
user.sendOthers("> " + data)
});
socket.on('close', function(hadError) { <- Callback
user.leave();
});
}).listen(8000);
Ryan joined Joyent, which
looked over Node
Initially, things worked well –
Node got traction
But… Stagnation started.
No new ES features, even when available in Chrome.
Fast Forward to last year
NodeJS was forked into Io.js
Goal: Modern V8
Goal: Modern APIs
Goal: Inclusivity
Goal: Adopt modern JS
Eventually, io.js won. The
projects merged.
The result of the io.js fork:
Modern V8 version.
NodeJS on top of the io.js fork rather than the
Joyent repo.
Handing over of the Joyent repo to the NodeJS
foundation.
Community governance.
Lots of new features for the community.
Just how different is Node
today?
Current version: Node 7+
Node 0.12 – last year
function persistCriticalFile(cb) {
fs.readFile("criticalFile", function(err, data) {
if(err) return cb(err);
db.persist("collection", process(data), function(err, result) {
if(err) return cb(err);
cb(null, result);
});
});
}
Current version: Node 7+
Node 7 – this year
async function persistCriticalFile(cb) {
const data = await fs.readFileAsync("criticalFile");
return await db.persistAsync("collection", process(data));
}
So – how do we develop with Node 7?
Let’s look at a simple scenario. You want to get the comments to a post
on your site.
- First, from the cache if they’re there.
- If they’re not, from the database.
So – how do we develop with Node 7?
Node 0.x:
app.get('/getComments/:userId', function(req, res){
var userId = req.params.userId;
commentCache.get(userId, function(err, data) {
if(err) {
instrumentation.log(err);
return res.json(err);
}
if(data) return res.json(data);
db.getCommentsByUserId(userId, function(err, data) {
if(err) {
instrumentation.log(err);
return res.status(500).end(err);
}
cache.store(data, function() {});
return res.json(data);
});
});
});
So – how do we develop with Node 7?
Node 0.x:
app.get('/getComments/:userId', function(req, res){
var userId = req.params.userId;
commentCache.get(userId, function(err, data) {
if(err) {
instrumentation.log(err);
return res.json(err);
}
if(data) return res.json(data);
db.getCommentsByUserId(userId, function(err, data) {
if(err) {
instrumentation.log(err);
return res.status(500).end(err);
}
cache.store(data, function() {});
return res.json(data);
});
});
});
So – how do we develop with Node 7?
Node 0.x:
app.get('/getComments/:userId', function(req, res){
var userId = req.params.userId;
commentCache.get(userId, function(err, data) {
if(err) {
instrumentation.log(err);
return res.json(err);
}
if(data) return res.json(data);
db.getCommentsByUserId(userId, function(err, data) {
if(err) {
instrumentation.log(err);
return res.status(500).end(err);
}
cache.store(data, function() {});
return res.json(data);
});
});
});
So – how do we develop with Node 7?
Node 0.x:
app.get('/getComments/:userId', function(req, res){
var userId = req.params.userId;
commentCache.get(userId, function(err, data) {
if(err) {
instrumentation.log(err);
return res.json(err);
}
if(data) return res.json(data);
db.getCommentsByUserId(userId, function(err, data) {
if(err) {
instrumentation.log(err);
return res.status(500).end(err);
}
cache.store(data, function() {});
return res.json(data);
});
});
});
So – how do we develop with Node 7?
Node 0.x:
db.getCommentsByUserId(userId, function(err, data) {
if(err) {
instrumentation.log(err);
return res.status(500).end(err);
}
cache.store(data, function() {});
return res.json(data);
});
});
So – how do we develop with Node 7?
app.get('/getComments/:userId', ({params: {userId}}, res) => {
const fromCache = await commentCache.get(userId);
if(fromCache) return res.json(fromCache);
const fromDb = await db.getCommentsByUserId(userId);
res.json(fromDb);
commentCache.store(userId, fromDb);
});
How our flow has changed: tests
Old
it("does something", function(done) {
myApi("someData", function(err, result) {
assert.equal(err, null);
assert.equal(result === 3);
done();
});
});
New
it("does something", async () => {
assert.equal(await myApi("someData", 3));
});
How our flow has changed: classes
Old
function User(id) {
this.id = id;
}
User.prototype.foo = function(id){
doBar(id);
}
New
class User {
constructor(id) { this.id = id }
foo() { doBar(id); }
}
How our development flow changed.
• Hot reload servers in JS
• Node first approaches in client side flows
• The rise of universal JS
How our web flow changed.
• Rest vs. GraphQL/Falcor.
• Native debugger.
• Handling request/response cycles.
• How express changed.
• How clustering changed.
How production changed.
• The rise of containers.
• More people into node.
• Community got a lot bigger, a lot more mature.
• Node backed by major companies.
• Node for IoT, node on Chakra.
What’s coming next?
Async Iterators
async function* map(fn) {
// async + generator, great stream processing
for await(const value of this) yield fn(value);
};
Observables
Core API Promises
node –expose-wasm
ES Modules
import {some, other} from "module name"
libuv.js
Lower level NodeJS
Code?
Just a few words about open
source
You don’t have to be an expert
We’ll onboard you
Node is actively looking…
benjamingr@gmail.com
Questions?
The Past
The Present
The Future
Thank You

More Related Content

PPTX
“Purikura” culture in Japan and our web application architecture
KEY
A million connections and beyond - Node.js at scale
PPTX
Node.js: A Guided Tour
KEY
NodeJS
PPTX
Node.js, for architects - OpenSlava 2013
PDF
NodeJS for Beginner
KEY
Building HTTP API's with NodeJS and MongoDB
PPTX
Util.promisify
“Purikura” culture in Japan and our web application architecture
A million connections and beyond - Node.js at scale
Node.js: A Guided Tour
NodeJS
Node.js, for architects - OpenSlava 2013
NodeJS for Beginner
Building HTTP API's with NodeJS and MongoDB
Util.promisify

What's hot (20)

KEY
node.js: Javascript's in your backend
ODP
Asynchronous I/O in NodeJS - new standard or challenges?
PPTX
Introduction Node.js
KEY
Writing robust Node.js applications
PDF
Updates to the java api for json processing for java ee 8
PDF
Google App Engine Developer - Day4
PDF
Web components with java by Haijian Wang
ODP
Consume Spring Data Rest with Angularjs
PPTX
Intro to node and non blocking io
PPT
Headless drupal + react js Oleksandr Linyvyi
PPT
Developing node-mdb: a Node.js - based clone of SimpleDB
PDF
Devoxx uk 2014 High performance in-memory Java with open source
PDF
Building servers with Node.js
PDF
[Hatsune Miku] Shoot Frieza with Amazon Kinesis ! [EN]
PDF
Introduction to Node.js: perspectives from a Drupal dev
PDF
FwDays 2021: Metarhia Technology Stack for Node.js
PPT
Mssql to mysql - Anton Ivanov
PPTX
introduction to node.js
PDF
Data processing with celery and rabbit mq
PDF
Introduction to Node.js Platform
node.js: Javascript's in your backend
Asynchronous I/O in NodeJS - new standard or challenges?
Introduction Node.js
Writing robust Node.js applications
Updates to the java api for json processing for java ee 8
Google App Engine Developer - Day4
Web components with java by Haijian Wang
Consume Spring Data Rest with Angularjs
Intro to node and non blocking io
Headless drupal + react js Oleksandr Linyvyi
Developing node-mdb: a Node.js - based clone of SimpleDB
Devoxx uk 2014 High performance in-memory Java with open source
Building servers with Node.js
[Hatsune Miku] Shoot Frieza with Amazon Kinesis ! [EN]
Introduction to Node.js: perspectives from a Drupal dev
FwDays 2021: Metarhia Technology Stack for Node.js
Mssql to mysql - Anton Ivanov
introduction to node.js
Data processing with celery and rabbit mq
Introduction to Node.js Platform
Ad

Similar to Modern server side development with node.js - Benjamin gruenbaum (20)

PDF
Why Node.js
PDF
Why Nodejs Guilin Shanghai
PPTX
Introduction to Node.js
KEY
Practical Use of MongoDB for Node.js
PPTX
Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)
PDF
Developing realtime apps with Drupal and NodeJS
PPTX
NodeJS
PDF
Intro to React - Featuring Modern JavaScript
PDF
Getting started with node JS
PDF
Node.js introduction
ODP
Node js
PPTX
Event-driven IO server-side JavaScript environment based on V8 Engine
PDF
Day In A Life Of A Node.js Developer
PDF
Day in a life of a node.js developer
PDF
Top 30 Node.js interview questions
PDF
Backend Development Bootcamp - Node [Online & Offline] In Bangla
PDF
Json generation
PPTX
Intro to node and mongodb 1
PPTX
NodeJS Tour
PPT
Node js
Why Node.js
Why Nodejs Guilin Shanghai
Introduction to Node.js
Practical Use of MongoDB for Node.js
Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)
Developing realtime apps with Drupal and NodeJS
NodeJS
Intro to React - Featuring Modern JavaScript
Getting started with node JS
Node.js introduction
Node js
Event-driven IO server-side JavaScript environment based on V8 Engine
Day In A Life Of A Node.js Developer
Day in a life of a node.js developer
Top 30 Node.js interview questions
Backend Development Bootcamp - Node [Online & Offline] In Bangla
Json generation
Intro to node and mongodb 1
NodeJS Tour
Node js
Ad

More from geektimecoil (17)

PPTX
Solving modern API / Idan gazit
PPTX
Big data and machine learning / Gil Chamiel
PPTX
Early detection of cancer using NLP / Limor Lahiani
PPTX
Natural human to machine communication / Alon eirew
PPTX
The psychology of technology / Zohar arad
PDF
iOs app localization / Yoni tsafir
PDF
a friend in need-a js indeed / Yonatan levin
PDF
Building your architect skillset / Rachel Ebner
PDF
Engineering your culture / Oren Ellenbogen
PDF
Scaling CTO / On Freund
PPTX
measuring and monitoring client side performance / Nir Nahum
PDF
The impactful engineer / Joey Simhon
PPTX
Jelly button growth Case study / Ron Rajwan
PDF
Outbound b2b sales are not dead – they’ve just evolved / Yanay Sela
PDF
Viber Growth Case Studay - playing with giants / Moshi Blum
PPTX
Paid Apps Economy / Nir Pochter
PDF
Moovit Growth Case Study / Yovav Meydad
Solving modern API / Idan gazit
Big data and machine learning / Gil Chamiel
Early detection of cancer using NLP / Limor Lahiani
Natural human to machine communication / Alon eirew
The psychology of technology / Zohar arad
iOs app localization / Yoni tsafir
a friend in need-a js indeed / Yonatan levin
Building your architect skillset / Rachel Ebner
Engineering your culture / Oren Ellenbogen
Scaling CTO / On Freund
measuring and monitoring client side performance / Nir Nahum
The impactful engineer / Joey Simhon
Jelly button growth Case study / Ron Rajwan
Outbound b2b sales are not dead – they’ve just evolved / Yanay Sela
Viber Growth Case Studay - playing with giants / Moshi Blum
Paid Apps Economy / Nir Pochter
Moovit Growth Case Study / Yovav Meydad

Recently uploaded (20)

PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Machine learning based COVID-19 study performance prediction
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Spectroscopy.pptx food analysis technology
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Big Data Technologies - Introduction.pptx
DOCX
The AUB Centre for AI in Media Proposal.docx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Digital-Transformation-Roadmap-for-Companies.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
The Rise and Fall of 3GPP – Time for a Sabbatical?
Machine learning based COVID-19 study performance prediction
NewMind AI Weekly Chronicles - August'25 Week I
MIND Revenue Release Quarter 2 2025 Press Release
Mobile App Security Testing_ A Comprehensive Guide.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Per capita expenditure prediction using model stacking based on satellite ima...
Advanced methodologies resolving dimensionality complications for autism neur...
Spectroscopy.pptx food analysis technology
Encapsulation_ Review paper, used for researhc scholars
Programs and apps: productivity, graphics, security and other tools
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Empathic Computing: Creating Shared Understanding
Big Data Technologies - Introduction.pptx
The AUB Centre for AI in Media Proposal.docx

Modern server side development with node.js - Benjamin gruenbaum

  • 1. Modern Server Side Development with NodeJS What changed since the 0.10 days Benjamin Gruenbaum
  • 2. Benjamin Gruenbaum • I work @ TipRanks • NodeJS core collaborator. • Promises guy, bluebird fan and core contributor. • I argue with people online. • StackOverflow guy.
  • 3. This talk is in 3 parts The Past The Present The Future
  • 4. Let’s go back to 2009
  • 6. JavaScript on the server is an old idea Netscape Enterprise Server – 1995 Steve Yegge’s Server – 2008
  • 7. JavaScript on the server is a good idea? Remember, 2008- JavaScript engines are painfully slow. APIs were nonexistent. Language was hated.
  • 8. Suddenly – V8 Google needed fast JavaScript in Chrome – so JavaScript engines became fast.
  • 9. This Ryan guy thought… let’s make a non-blocking server. As in – no thread “block”s in the user server code.
  • 10. What can we write this in? We need a language that doesn’t have file/net APIs yet to get a sane ecosystem.
  • 11. JavaScript has no blocking APIs
  • 12. The Result – solving “The 10K Problem”
  • 13. How: The Event Loop Threads and OS non-blocking APIs push things into queues User code runs on a single thread and executes handlers on the queues
  • 14. Why even write node? It’s fast enough.
  • 15. Why even write node? Server and client in one language
  • 16. Why even write node? It was cool Remember: in 2009 JS is all the hotness
  • 17. Code Sample: Chat Server net.createServer(function(socket) { var user = users.add(socket) socket.on('data', function(data) { <- Callback user.sendOthers("> " + data) }); socket.on('close', function(hadError) { <- Callback user.leave(); }); }).listen(8000);
  • 18. Ryan joined Joyent, which looked over Node
  • 19. Initially, things worked well – Node got traction
  • 20. But… Stagnation started. No new ES features, even when available in Chrome.
  • 21. Fast Forward to last year
  • 22. NodeJS was forked into Io.js
  • 27. Eventually, io.js won. The projects merged.
  • 28. The result of the io.js fork: Modern V8 version. NodeJS on top of the io.js fork rather than the Joyent repo. Handing over of the Joyent repo to the NodeJS foundation. Community governance. Lots of new features for the community.
  • 29. Just how different is Node today?
  • 30. Current version: Node 7+ Node 0.12 – last year function persistCriticalFile(cb) { fs.readFile("criticalFile", function(err, data) { if(err) return cb(err); db.persist("collection", process(data), function(err, result) { if(err) return cb(err); cb(null, result); }); }); }
  • 31. Current version: Node 7+ Node 7 – this year async function persistCriticalFile(cb) { const data = await fs.readFileAsync("criticalFile"); return await db.persistAsync("collection", process(data)); }
  • 32. So – how do we develop with Node 7? Let’s look at a simple scenario. You want to get the comments to a post on your site. - First, from the cache if they’re there. - If they’re not, from the database.
  • 33. So – how do we develop with Node 7? Node 0.x: app.get('/getComments/:userId', function(req, res){ var userId = req.params.userId; commentCache.get(userId, function(err, data) { if(err) { instrumentation.log(err); return res.json(err); } if(data) return res.json(data); db.getCommentsByUserId(userId, function(err, data) { if(err) { instrumentation.log(err); return res.status(500).end(err); } cache.store(data, function() {}); return res.json(data); }); }); });
  • 34. So – how do we develop with Node 7? Node 0.x: app.get('/getComments/:userId', function(req, res){ var userId = req.params.userId; commentCache.get(userId, function(err, data) { if(err) { instrumentation.log(err); return res.json(err); } if(data) return res.json(data); db.getCommentsByUserId(userId, function(err, data) { if(err) { instrumentation.log(err); return res.status(500).end(err); } cache.store(data, function() {}); return res.json(data); }); }); });
  • 35. So – how do we develop with Node 7? Node 0.x: app.get('/getComments/:userId', function(req, res){ var userId = req.params.userId; commentCache.get(userId, function(err, data) { if(err) { instrumentation.log(err); return res.json(err); } if(data) return res.json(data); db.getCommentsByUserId(userId, function(err, data) { if(err) { instrumentation.log(err); return res.status(500).end(err); } cache.store(data, function() {}); return res.json(data); }); }); });
  • 36. So – how do we develop with Node 7? Node 0.x: app.get('/getComments/:userId', function(req, res){ var userId = req.params.userId; commentCache.get(userId, function(err, data) { if(err) { instrumentation.log(err); return res.json(err); } if(data) return res.json(data); db.getCommentsByUserId(userId, function(err, data) { if(err) { instrumentation.log(err); return res.status(500).end(err); } cache.store(data, function() {}); return res.json(data); }); }); });
  • 37. So – how do we develop with Node 7? Node 0.x: db.getCommentsByUserId(userId, function(err, data) { if(err) { instrumentation.log(err); return res.status(500).end(err); } cache.store(data, function() {}); return res.json(data); }); });
  • 38. So – how do we develop with Node 7? app.get('/getComments/:userId', ({params: {userId}}, res) => { const fromCache = await commentCache.get(userId); if(fromCache) return res.json(fromCache); const fromDb = await db.getCommentsByUserId(userId); res.json(fromDb); commentCache.store(userId, fromDb); });
  • 39. How our flow has changed: tests Old it("does something", function(done) { myApi("someData", function(err, result) { assert.equal(err, null); assert.equal(result === 3); done(); }); }); New it("does something", async () => { assert.equal(await myApi("someData", 3)); });
  • 40. How our flow has changed: classes Old function User(id) { this.id = id; } User.prototype.foo = function(id){ doBar(id); } New class User { constructor(id) { this.id = id } foo() { doBar(id); } }
  • 41. How our development flow changed. • Hot reload servers in JS • Node first approaches in client side flows • The rise of universal JS
  • 42. How our web flow changed. • Rest vs. GraphQL/Falcor. • Native debugger. • Handling request/response cycles. • How express changed. • How clustering changed.
  • 43. How production changed. • The rise of containers. • More people into node. • Community got a lot bigger, a lot more mature. • Node backed by major companies. • Node for IoT, node on Chakra.
  • 45. Async Iterators async function* map(fn) { // async + generator, great stream processing for await(const value of this) yield fn(value); };
  • 49. ES Modules import {some, other} from "module name"
  • 51. Code?
  • 52. Just a few words about open source You don’t have to be an expert We’ll onboard you
  • 53. Node is actively looking… benjamingr@gmail.com