SlideShare a Scribd company logo
Meetup #1
Farsheed & Eddy
Sponsored by Drumbi
Food for Thought
● Packages per day across popular platforms
● Source: https://blog.nodejitsu.com/npm-innovation-through-modularity
Who We Are
● Farsheed Atef
● @captainatef
● Farsheed@Drumbi.com
● Eddy Kim
● @EddyDKim
● eddy@Drumbi.com
● Drumbi
● Drumbi.com
● Blog.Drumbi.com
● @getdrumbi
Overview
● What is Node.js
● Why Node.js
● Benefits
● JavaScript
● Modularity
● Scalability
● Architecture
● Resources/Documentation
● Hands On
What is Node.js
● A framework for developing I/O based javascript server applications
● Node.js is a set of bindings to the V8 javascript VM.
● V8 is Google's open source JavaScript engine.
● Used in Chrome
● Standalone or embedded
● Octane (https://developers.google.com/octane/)
● Focused on performance
Why Node.js
● Programmable Web
● Internet of Devices
● Requires: Scalable / Real-time
platform
● Benchmark (take with grain of salt):
● 100 Concurrent clients
● 1 megabyte response
● Node 822 req/sec
● Nginx 708 req/sec
● Thin 85 req/sec
● Mongrel 4 req/sec
http = require(’http’)
Buffer = require(’buffer’).Buffer;
n = 1024*1024;
b = new Buffer(n);
for (var i = 0; i<n; i++) b[i] = 100;
http.createServer(function (req, res) {
res.writeHead(200);
res.end(b);
}).listen(80);
Why Node.js
● Typical request
● Request a page
● Do a bunch of client stuff
● Load a bunch of static stuff
● Load a bunch of dynamic stuff
● Call a web service (Network)
● Call a Database (Network)
● Database get data (Disk, CPU)
● Format returned data (CPU, RAM)
● display data (CPU, RAM)
Why Node.js
● npm Packages
● JavaScript on Server
● Real-Time
● Design Goals:
○ Built in support for
DNS, HTTP, TLS
○ Stream Everything
○ No function should directly
perform I/O
○ Simple License MIT/BSD
● Be Careful
○ Blocking operations
Event Driven Programming
● Typical programming (multithreading - memory hungry):
○ Ask for some data
○ Wait for the person to enter
○ Do something with the submitted data
○ Display the results
● Functional programming:
○ Ask for some data
○ while waiting for the person to enter something, ask for data from someone
else, process some data, display results to someone whose data is ready.
JavaScript
● First Class Functions
● Lambdas
● Available across all web browsers
● Closures
Why Javascript?
Ubiquity
Code Re-use
Existing Skillset/Libraries
-moment js
-underscore js
Why Javascript?
Functions are 1st class objects
Ideally suited for Evented/Async Programming
Why Javascript?
Functions as Objects in Async Programming
Why Javascript?
Closures in a Nutshell
● Allows Inner Functions to access variables in Outer Function
○ Very useful for event callback patterns
Why Javascript?
Closures in a Nutshell
● Enables Data Encapsulation via local scopes
Modularity
● NodeJS focuses on quality, small modules
○ export via module.exports =
○ import via require('moduleName')
Resources
http://nodejs.org/
http://javascriptissexy.com/
http://stackoverflow.com/questions/2353818/how-do-i-get-
started-with-node-js
eddy@drumbi.com
farsheed@drumbi.com
Hands On
● Node JS Installation
○ http://nodejs.org/download/
● Creating a hello world using Http Module
● Creating a web using Express Module

More Related Content

NODE JS OC Meetup 1

  • 1. Meetup #1 Farsheed & Eddy Sponsored by Drumbi
  • 2. Food for Thought ● Packages per day across popular platforms ● Source: https://blog.nodejitsu.com/npm-innovation-through-modularity
  • 3. Who We Are ● Farsheed Atef ● @captainatef ● Farsheed@Drumbi.com ● Eddy Kim ● @EddyDKim ● eddy@Drumbi.com ● Drumbi ● Drumbi.com ● Blog.Drumbi.com ● @getdrumbi
  • 4. Overview ● What is Node.js ● Why Node.js ● Benefits ● JavaScript ● Modularity ● Scalability ● Architecture ● Resources/Documentation ● Hands On
  • 5. What is Node.js ● A framework for developing I/O based javascript server applications ● Node.js is a set of bindings to the V8 javascript VM. ● V8 is Google's open source JavaScript engine. ● Used in Chrome ● Standalone or embedded ● Octane (https://developers.google.com/octane/) ● Focused on performance
  • 6. Why Node.js ● Programmable Web ● Internet of Devices ● Requires: Scalable / Real-time platform ● Benchmark (take with grain of salt): ● 100 Concurrent clients ● 1 megabyte response ● Node 822 req/sec ● Nginx 708 req/sec ● Thin 85 req/sec ● Mongrel 4 req/sec http = require(’http’) Buffer = require(’buffer’).Buffer; n = 1024*1024; b = new Buffer(n); for (var i = 0; i<n; i++) b[i] = 100; http.createServer(function (req, res) { res.writeHead(200); res.end(b); }).listen(80);
  • 7. Why Node.js ● Typical request ● Request a page ● Do a bunch of client stuff ● Load a bunch of static stuff ● Load a bunch of dynamic stuff ● Call a web service (Network) ● Call a Database (Network) ● Database get data (Disk, CPU) ● Format returned data (CPU, RAM) ● display data (CPU, RAM)
  • 8. Why Node.js ● npm Packages ● JavaScript on Server ● Real-Time ● Design Goals: ○ Built in support for DNS, HTTP, TLS ○ Stream Everything ○ No function should directly perform I/O ○ Simple License MIT/BSD ● Be Careful ○ Blocking operations
  • 9. Event Driven Programming ● Typical programming (multithreading - memory hungry): ○ Ask for some data ○ Wait for the person to enter ○ Do something with the submitted data ○ Display the results ● Functional programming: ○ Ask for some data ○ while waiting for the person to enter something, ask for data from someone else, process some data, display results to someone whose data is ready.
  • 10. JavaScript ● First Class Functions ● Lambdas ● Available across all web browsers ● Closures
  • 11. Why Javascript? Ubiquity Code Re-use Existing Skillset/Libraries -moment js -underscore js
  • 12. Why Javascript? Functions are 1st class objects Ideally suited for Evented/Async Programming
  • 13. Why Javascript? Functions as Objects in Async Programming
  • 14. Why Javascript? Closures in a Nutshell ● Allows Inner Functions to access variables in Outer Function ○ Very useful for event callback patterns
  • 15. Why Javascript? Closures in a Nutshell ● Enables Data Encapsulation via local scopes
  • 16. Modularity ● NodeJS focuses on quality, small modules ○ export via module.exports = ○ import via require('moduleName')
  • 18. Hands On ● Node JS Installation ○ http://nodejs.org/download/ ● Creating a hello world using Http Module ● Creating a web using Express Module