SlideShare a Scribd company logo
Introduction to Node.JS
      By Derek Anderson
I CAN HAS
SERVER-SIDE !!?
What is Node.JS?

Evented I/O for V8 JavaScript
What is Node.JS?

Evented I/O for V8 JavaScript
What is Node.JS?

Evented I/O for V8 JavaScript
Why?

Node's goal is to provide an easy way
to build scalable network programs.
                               - nodejs.org
Traditional I/O
var data = fs.readFile('large.mov');

// Wait until file.read finishes
doSomethingWith(data);



Waiting for disk operation to finish is slow!
Asynchronous I/O
fs.readFile('large.mov', function(data){
  doSomethingWith(data);
});

// Do Something Else Right Away!
doSomethingElse();


Read from the disk, and fire a callback when done.
        Meanwhile, Do Something Else!

                                      Inspiration: Felix Geisendörfer
THE GOOD
• JavaScript on the Server
THE GOOD
• JavaScript on the Server
• Desktop / Web / CLI Applications
THE GOOD
• JavaScript on the Server
• Desktop / Web / CLI Applications
• Non Blocking I/O: DB, Filesystems, etc
THE GOOD
• JavaScript on the Server
• Write CLI / GUI Applications
• Non Blocking I/O: DB, Filesystems, etc
• NPM : Node Package Manager
THE GOOD
• JavaScript on the Server
• Write CLI / GUI Applications
• Non Blocking I/O: DB, Filesystems, etc
• NPM : Node Package Manager
• Active and friendly Community
Getting Started
Installation
            Compile from Source
https://github.com/joyent/node/wiki/Installation

                 Install NPM
  $ curl http://npmjs.org/install.sh | sh
Hello World
                                    /hello-world.js

      console.log('Hello World');




$ node hello-world.js
 Hello World
Core Modules
• HTTP/HTTPS - Rock on!
Core Modules
• HTTP/HTTPS - Rock on!
• TCP - That’s nifty...
Core Modules
• HTTP/HTTPS - Rock on!
• TCP - That’s nifty...
• DNS - Perform DNS operations
Core Modules
• HTTP/HTTPS - Rock on!
• TCP - That’s nifty...
• DNS - Perform DNS operations
• Filesystems - read/write/watch !!
Core Modules
• HTTP/HTTPS - Rock on!
• TCP - That’s nifty...
• DNS - Perform DNS operations
• Filesystems - read/write/watch !!
• Crypto, SSL/TLS, Readline, etc...
Core Modules
     • HTTP/HTTPS - Rock on!
     • TCP - That’s nifty...
     • DNS - Perform DNS operations
     • Filesystems - read/write/watch !!
     • Crypto, SSL/TLS, Readline, etc...
Over 3,400 Community Modules and counting !
          http://search.npmjs.org/
Modules
var fs = require('fs'),
  sys = require('sys'),
  http = require('http'),
  foo = require('./lib/foo'),
  bar = require('./lib/bar');

Import system wide modules such as fs,
sys, http or local modules like /lib/foo.js
Roll Your Own Modules
                                        lib/say.js
   exports.say = function(something){
     return something;
   }

                                        server.js
   var baz = require('./lib/say');
   console.log(baz.say('Foo Bar!'));



 $ node server.js
  Foo Bar!
HTTP Server
If you want to make an HTTP Server,
you must first create the universe.
                          - Carl Sagan
HTTP Server
                                                        /hello-http.js
var http = require('http')

http.createServer(function(req, res){
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World!');
}).listen(3000);

console.log('Hello World');


     $ node hello-http.js
      Server Running
HTTP Server
Resources & Tutorials
Resources & Tutorials
  List of Resources from Joyent
   https://github.com/joyent/node/wiki/Resources

    Node.js Beginners Guide
        http://nodeguide.com/beginner.html

              Read the API
         http://nodejs.org/docs/latest/api/
DEMO TIME
Questions




                            ?http://github.com/mediaupstream

email: derek@mediaupstream.com            twitter: @derekanderson

More Related Content

What's hot (18)

PPTX
GeekCampSG - Nodejs , Websockets and Realtime Web
Bhagaban Behera
 
PDF
Node js quick tour v2
Wyatt Fang
 
PDF
Nodejs - Should Ruby Developers Care?
Felix Geisendörfer
 
PDF
Introduction to Node.js: What, why and how?
Christian Joudrey
 
KEY
Node.js - As a networking tool
Felix Geisendörfer
 
ODP
Presentation of JSConf.eu
Fredrik Wendt
 
PPTX
WorkFlow: An Inquiry Into Productivity by Timothy Bolton
Miva
 
PDF
Create a RESTful API with NodeJS, Express and MongoDB
Hengki Sihombing
 
PDF
Per beginners2
Junichi Ishida
 
KEY
Server side scripting smack down - Node.js vs PHP
Marc Gear
 
PDF
Happy Browser, Happy User! WordSesh 2019
Katie Sylor-Miller
 
PDF
Node.js and Ruby
Michael Bleigh
 
PDF
Docker
Kamil Grabowski
 
ODP
SockJS Intro
Ngoc Dao
 
PDF
Complete MVC on NodeJS
Hüseyin BABAL
 
PDF
Dirty - How simple is your database?
Felix Geisendörfer
 
PPT
Don’t turn your logs into cuneiform
Andrey Rebrov
 
PDF
Node.js
Jan Dillmann
 
GeekCampSG - Nodejs , Websockets and Realtime Web
Bhagaban Behera
 
Node js quick tour v2
Wyatt Fang
 
Nodejs - Should Ruby Developers Care?
Felix Geisendörfer
 
Introduction to Node.js: What, why and how?
Christian Joudrey
 
Node.js - As a networking tool
Felix Geisendörfer
 
Presentation of JSConf.eu
Fredrik Wendt
 
WorkFlow: An Inquiry Into Productivity by Timothy Bolton
Miva
 
Create a RESTful API with NodeJS, Express and MongoDB
Hengki Sihombing
 
Per beginners2
Junichi Ishida
 
Server side scripting smack down - Node.js vs PHP
Marc Gear
 
Happy Browser, Happy User! WordSesh 2019
Katie Sylor-Miller
 
Node.js and Ruby
Michael Bleigh
 
SockJS Intro
Ngoc Dao
 
Complete MVC on NodeJS
Hüseyin BABAL
 
Dirty - How simple is your database?
Felix Geisendörfer
 
Don’t turn your logs into cuneiform
Andrey Rebrov
 
Node.js
Jan Dillmann
 

Similar to Introduction to NodeJS with LOLCats (20)

PPTX
Introduction to node
girish82
 
PDF
Nodejs a-practical-introduction-oredev
Felix Geisendörfer
 
PPTX
Node.js Workshop - Sela SDP 2015
Nir Noy
 
PPTX
Introduction to Node.js
Vikash Singh
 
PPTX
Nodejs
Vinod Kumar Marupu
 
KEY
Node.js - The New, New Hotness
Daniel Shaw
 
ODP
Introduce about Nodejs - duyetdev.com
Van-Duyet Le
 
PPTX
Introduction to node.js by jiban
Jibanananda Sana
 
PPT
nodejs_at_a_glance.ppt
WalaSidhom1
 
PPT
nodejs_at_a_glance, understanding java script
mohammedarshadhussai4
 
PPTX
Proposal
Constantine Priemski
 
PDF
Node intro
Vishal Sharma
 
PPT
Node js beginner
Sureshreddy Nalimela
 
DOCX
Node js getting started
Pallavi Srivastava
 
PDF
NodeJS for Beginner
Apaichon Punopas
 
PDF
Introduction to Node js for beginners + game project
Laurence Svekis ✔
 
PPTX
Intro to Node.js (v1)
Chris Cowan
 
PPTX
Introducing Node.js in an Oracle technology environment (including hands-on)
Lucas Jellema
 
PPTX
Introduction to node.js GDD
Sudar Muthu
 
Introduction to node
girish82
 
Nodejs a-practical-introduction-oredev
Felix Geisendörfer
 
Node.js Workshop - Sela SDP 2015
Nir Noy
 
Introduction to Node.js
Vikash Singh
 
Node.js - The New, New Hotness
Daniel Shaw
 
Introduce about Nodejs - duyetdev.com
Van-Duyet Le
 
Introduction to node.js by jiban
Jibanananda Sana
 
nodejs_at_a_glance.ppt
WalaSidhom1
 
nodejs_at_a_glance, understanding java script
mohammedarshadhussai4
 
Node intro
Vishal Sharma
 
Node js beginner
Sureshreddy Nalimela
 
Node js getting started
Pallavi Srivastava
 
NodeJS for Beginner
Apaichon Punopas
 
Introduction to Node js for beginners + game project
Laurence Svekis ✔
 
Intro to Node.js (v1)
Chris Cowan
 
Introducing Node.js in an Oracle technology environment (including hands-on)
Lucas Jellema
 
Introduction to node.js GDD
Sudar Muthu
 
Ad

Recently uploaded (20)

PDF
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
Advancing WebDriver BiDi support in WebKit
Igalia
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
IoT-Powered Industrial Transformation – Smart Manufacturing to Connected Heal...
Rejig Digital
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Advancing WebDriver BiDi support in WebKit
Igalia
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Ad

Introduction to NodeJS with LOLCats

  • 1. Introduction to Node.JS By Derek Anderson
  • 3. What is Node.JS? Evented I/O for V8 JavaScript
  • 4. What is Node.JS? Evented I/O for V8 JavaScript
  • 5. What is Node.JS? Evented I/O for V8 JavaScript
  • 6. Why? Node's goal is to provide an easy way to build scalable network programs. - nodejs.org
  • 7. Traditional I/O var data = fs.readFile('large.mov'); // Wait until file.read finishes doSomethingWith(data); Waiting for disk operation to finish is slow!
  • 8. Asynchronous I/O fs.readFile('large.mov', function(data){ doSomethingWith(data); }); // Do Something Else Right Away! doSomethingElse(); Read from the disk, and fire a callback when done. Meanwhile, Do Something Else! Inspiration: Felix Geisendörfer
  • 9. THE GOOD • JavaScript on the Server
  • 10. THE GOOD • JavaScript on the Server • Desktop / Web / CLI Applications
  • 11. THE GOOD • JavaScript on the Server • Desktop / Web / CLI Applications • Non Blocking I/O: DB, Filesystems, etc
  • 12. THE GOOD • JavaScript on the Server • Write CLI / GUI Applications • Non Blocking I/O: DB, Filesystems, etc • NPM : Node Package Manager
  • 13. THE GOOD • JavaScript on the Server • Write CLI / GUI Applications • Non Blocking I/O: DB, Filesystems, etc • NPM : Node Package Manager • Active and friendly Community
  • 15. Installation Compile from Source https://github.com/joyent/node/wiki/Installation Install NPM $ curl http://npmjs.org/install.sh | sh
  • 16. Hello World /hello-world.js console.log('Hello World'); $ node hello-world.js Hello World
  • 18. Core Modules • HTTP/HTTPS - Rock on! • TCP - That’s nifty...
  • 19. Core Modules • HTTP/HTTPS - Rock on! • TCP - That’s nifty... • DNS - Perform DNS operations
  • 20. Core Modules • HTTP/HTTPS - Rock on! • TCP - That’s nifty... • DNS - Perform DNS operations • Filesystems - read/write/watch !!
  • 21. Core Modules • HTTP/HTTPS - Rock on! • TCP - That’s nifty... • DNS - Perform DNS operations • Filesystems - read/write/watch !! • Crypto, SSL/TLS, Readline, etc...
  • 22. Core Modules • HTTP/HTTPS - Rock on! • TCP - That’s nifty... • DNS - Perform DNS operations • Filesystems - read/write/watch !! • Crypto, SSL/TLS, Readline, etc... Over 3,400 Community Modules and counting ! http://search.npmjs.org/
  • 23. Modules var fs = require('fs'), sys = require('sys'), http = require('http'), foo = require('./lib/foo'), bar = require('./lib/bar'); Import system wide modules such as fs, sys, http or local modules like /lib/foo.js
  • 24. Roll Your Own Modules lib/say.js exports.say = function(something){ return something; } server.js var baz = require('./lib/say'); console.log(baz.say('Foo Bar!')); $ node server.js Foo Bar!
  • 25. HTTP Server If you want to make an HTTP Server, you must first create the universe. - Carl Sagan
  • 26. HTTP Server /hello-http.js var http = require('http') http.createServer(function(req, res){ res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World!'); }).listen(3000); console.log('Hello World'); $ node hello-http.js Server Running
  • 29. Resources & Tutorials List of Resources from Joyent https://github.com/joyent/node/wiki/Resources Node.js Beginners Guide http://nodeguide.com/beginner.html Read the API http://nodejs.org/docs/latest/api/
  • 31. Questions ?http://github.com/mediaupstream email: [email protected] twitter: @derekanderson

Editor's Notes