SlideShare una empresa de Scribd logo
1 de 33
Descargar para leer sin conexión
What the frak is Node JS?




                                                  NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
Claudio Cicali

                                 @caludio

                            Front-end engineer at
                               SponsorPay


                                                NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
Installing NodeJS

        Download, unpack, make, make install

                             ... or use homebrew

                  (and yes! It works on Windows too)


                                                   NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
JavaScript is an interpreted language
            which means that you need an JavaScript
               interpreter to run your programs

                            We often refer to these beasts
                            as JavaScript Engines or
                              JavaScript Virtual Machine


                                                     NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
Every browser has its own VM

                             Firefox? Spidermonkey
                            Internet Explorer? Chakra
                                     Chrome? V8
                              Safari? JavaScriptCore
                                  Opera? Carakan

                             Also Rhino, stand alone
                                                  NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
2009: this guy had an idea

                            (he is Ryan Dahl, btw)

                                                  NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
Make no mistake

                        NodeJS is NOT a “one man project”

        It is backed by Joyent, which is a big player
                 in the cloud computing business
                      (has money and people)




                                                   NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
If you already can write JavaScript
            in the browser why can’t you write
           JavaScript on the server then?




                                       NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
js VMs are getting better and better

                 Get one of them, include some
                additional libraries and wrap it up
               into a powerful, directly executable
                       JavaScript platform


                                          NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
After the idea, the design:

                            Google V8 would have been the VM
                            (Tried using Spidermonkey, no luck)

                                 Monoprocess, no threads

      Completely event driven (asynchronous, non-blocking)

                              Focus on NETWORKING


                                                           NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
What is the “Node Standard Library”?

                      A set of ready-to-use tools which gives you

- a powerful HTTP(S) library (client and server in no time)
- DNS name resolution
- Crypto
- access to the file system
- URL manipulation
- ZLIB
- UDP datagrams

                              http://nodejs.org/docs/latest/api/
                                                             NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
Those tools can JavaScript only
        or mixed with some C or C++
            for performances reason



                              NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
Now we have a platform to write REAL programs
                   (i.e.: no sandboxing) in JavaScript

         The JavaScript itself - oh, joy - it’s the latest stable V8

                      AND NO COMPATIBILITY LAYER! (cries)




                                                                   except ...
                                                     NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
... except for Node JS itself


                      With every new major version, you might
                         loose compatibility at the API level
                             (the Node standard library)


                (this is really more of a youth problem, anyway)


                                                         NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
Node JS is fast, in theory

Low maintencance (small impact on resources)

                    Programs must not stress the CPU

                            Programming is not THAT easy

                              API are well documented
                                                      NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
The Node JS standard library
                     can be EXTENDED by the use of
                               modules

                        This is serious business:
                   the number of available modules is
                                 HUGE

                            (and the quality? Well...)
                                                    NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
MODULES in NodeJS use a well known
            pattern/paradigm/standard: CommonJS
            (which is well known thanks to... NodeJS)

                                  Writing a module is easy

                                      Maybe too much :)

                            (oh, and you’d write “addons” in C/C++ as well)


                                                                  NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
Take a look:

                    https://github.com/joyent/node/wiki/modules




                                                      NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
Module management is EASY with




                                   https://npmjs.org/

                No need to install it: comes with Node!
                           (Node >= 0.6)

          With brew you need to run npmjs.org/install.sh

                                                        NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
Need to access MySQL from your program?

                             npm install mysql




                                                   NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
Publishing your module to the world
                                    is freacking easy too
                               (no moderation, no approval...)

                                      npm publish




                                                         NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
Modules can be of any complexity


              Connect is a big “middleware” module
              which gives you cookies, sessions, logging,
                              caching...

       Express is a web framework built on top of
                       Connect

                                                      NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
What “using modules” means


        //  The  “fs”  module  is  ready  to  use
        var  fs  =  require(“fs”);

        fs.open(“somefile”,  “r”,  function(error)  {

            //  Do  something  with  the  file

        });




                                                    NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
claudioc$  npm  install  sqlite


        //  Once  installed  the  “sqlite”  module  is
        //  ready  to  use
        var  sqlite  =  require(“sqlite”);

        var  db  =  new  sqlite.Database();

        db.open(“my_db”,  function(error)  {

            //  Do  something  with  the  database

        });

                                                 NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
There are libraries which run in the browser
                   AND in NodeJS as modules (transparently)


                            “As of 3.5.0, YUI runs natively on
                            Node.js and comes with an official
                            npm package for easy installation.”




                                                        NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
What can NodeJS be used for then?
                    Network servers (HTTP, Proxies, messaging)

                                  API backends

                              Real time applications

                                  Streaming data

                              “One page” web sites

                               Command line tools

                                      Bots             NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
Let me introduce you a couple
         of things I’ve done with NodeJS




                                NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
antipad.com
                             Real time collaborative code editor

                                Built on the giants’ shoulders:

                                The ACE editor (awesome)

                            The ShareJS library (super awesome)

                                      NodeJS (lovely)



                                                              NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
jecho


                    “Poor man” command line remote debugger
                               for mobile devices



                            https://github.com/claudioc/jecho



                                                         NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
I want moar!

                     http://www.nodebeginner.org/
                        (highly recommended)

                            http://nodetoolbox.com

                             http://nodeguide.com
                                               NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
Follow me! @caludio
                                              NodeJS - © Claudio Cicali
Tuesday, December 4, 2012
One more thing

                      “The guys that are getting paid the big bucks
                      to deliver scalable solutions aren’t up at night
                      feverishly rewriting their systems in Node.
                      They’re doing what they’ve always done:
                      measuring, testing, benchmarking, thinking
                      hard, keeping up with the academic literature
                      that pertains to their problems.”

                                                       -- Alex Payne

                            http://al3x.net/2010/07/27/node.html
                                                            NodeJS - © Claudio Cicali
Tuesday, December 4, 2012

Más contenido relacionado

Destacado

Isomorphic web application
Isomorphic web applicationIsomorphic web application
Isomorphic web applicationOliver N
 
NodeJS guide for beginners
NodeJS guide for beginnersNodeJS guide for beginners
NodeJS guide for beginnersEnoch Joshua
 
Nodejs Event Driven Concurrency for Web Applications
Nodejs Event Driven Concurrency for Web ApplicationsNodejs Event Driven Concurrency for Web Applications
Nodejs Event Driven Concurrency for Web ApplicationsGanesh Iyer
 
Architecting large Node.js applications
Architecting large Node.js applicationsArchitecting large Node.js applications
Architecting large Node.js applicationsSergi Mansilla
 
The Enterprise Case for Node.js
The Enterprise Case for Node.jsThe Enterprise Case for Node.js
The Enterprise Case for Node.jsNodejsFoundation
 

Destacado (7)

Isomorphic web application
Isomorphic web applicationIsomorphic web application
Isomorphic web application
 
NodeJS guide for beginners
NodeJS guide for beginnersNodeJS guide for beginners
NodeJS guide for beginners
 
Nodejs Event Driven Concurrency for Web Applications
Nodejs Event Driven Concurrency for Web ApplicationsNodejs Event Driven Concurrency for Web Applications
Nodejs Event Driven Concurrency for Web Applications
 
Architecting large Node.js applications
Architecting large Node.js applicationsArchitecting large Node.js applications
Architecting large Node.js applications
 
NodeJS for Beginner
NodeJS for BeginnerNodeJS for Beginner
NodeJS for Beginner
 
The Enterprise Case for Node.js
The Enterprise Case for Node.jsThe Enterprise Case for Node.js
The Enterprise Case for Node.js
 
Node.js - Best practices
Node.js  - Best practicesNode.js  - Best practices
Node.js - Best practices
 

Similar a Introduction to NodeJS

Cloud Camp Chicago Dec 2012 Slides
Cloud Camp Chicago Dec 2012 SlidesCloud Camp Chicago Dec 2012 Slides
Cloud Camp Chicago Dec 2012 SlidesRyan Koop
 
Cloud Camp Chicago Dec 2012 - All presentations
Cloud Camp Chicago Dec 2012 - All presentationsCloud Camp Chicago Dec 2012 - All presentations
Cloud Camp Chicago Dec 2012 - All presentationsCloudCamp Chicago
 
Building businesspost.ie using Node.js
Building businesspost.ie using Node.jsBuilding businesspost.ie using Node.js
Building businesspost.ie using Node.jsRichard Rodger
 
Basic Concept of Node.js & NPM
Basic Concept of Node.js & NPMBasic Concept of Node.js & NPM
Basic Concept of Node.js & NPMBhargav Anadkat
 
What are some misconceptions about node js
What are some misconceptions about node jsWhat are some misconceptions about node js
What are some misconceptions about node jsNarola Infotech
 
Node.js - Introduction and role in Frontend Development
Node.js - Introduction and role in Frontend DevelopmentNode.js - Introduction and role in Frontend Development
Node.js - Introduction and role in Frontend DevelopmentJulián David Duque
 
Node js presentation
Node js presentationNode js presentation
Node js presentationshereefsakr
 
All You Need to Know About Using Node.pdf
All You Need to Know About Using Node.pdfAll You Need to Know About Using Node.pdf
All You Need to Know About Using Node.pdfiDataScientists
 
Tool review
Tool reviewTool review
Tool reviewwm175309
 
Toppling Domino - 44CON 4012
Toppling Domino - 44CON 4012Toppling Domino - 44CON 4012
Toppling Domino - 44CON 401244CON
 
Exploring Next Generation Buildpacks - Anand Rao & Scott Deeg
Exploring Next Generation Buildpacks - Anand Rao & Scott DeegExploring Next Generation Buildpacks - Anand Rao & Scott Deeg
Exploring Next Generation Buildpacks - Anand Rao & Scott DeegVMware Tanzu
 
Node.js and Enterprise Web Apps: Know all About it
Node.js and Enterprise Web Apps: Know all About itNode.js and Enterprise Web Apps: Know all About it
Node.js and Enterprise Web Apps: Know all About itFibonalabs
 
What is Node.js_ Pros and Cons of Node.js Web App Development
What is Node.js_ Pros and Cons of Node.js Web App DevelopmentWhat is Node.js_ Pros and Cons of Node.js Web App Development
What is Node.js_ Pros and Cons of Node.js Web App DevelopmentSufalam Technologies
 
What is Node.js_ Pros and Cons of Node.js Web App Development.pdf
What is Node.js_ Pros and Cons of Node.js Web App Development.pdfWhat is Node.js_ Pros and Cons of Node.js Web App Development.pdf
What is Node.js_ Pros and Cons of Node.js Web App Development.pdfSufalam Technologies
 
What to expect while building your first nodeJS application
What to expect while building your first nodeJS applicationWhat to expect while building your first nodeJS application
What to expect while building your first nodeJS applicationAshish Sharma
 
Drupal Cloud to the rescue? Servers, Files, CDNs and Fun!
Drupal Cloud to the rescue? Servers, Files, CDNs and Fun!Drupal Cloud to the rescue? Servers, Files, CDNs and Fun!
Drupal Cloud to the rescue? Servers, Files, CDNs and Fun!a_c_m
 
Unity Loves HelNode - Helsinki Node.js November Meetup
Unity Loves HelNode - Helsinki Node.js November MeetupUnity Loves HelNode - Helsinki Node.js November Meetup
Unity Loves HelNode - Helsinki Node.js November MeetupHelsinki Node.js Meetup Group
 

Similar a Introduction to NodeJS (20)

Cloud Camp Chicago Dec 2012 Slides
Cloud Camp Chicago Dec 2012 SlidesCloud Camp Chicago Dec 2012 Slides
Cloud Camp Chicago Dec 2012 Slides
 
Cloud Camp Chicago Dec 2012 - All presentations
Cloud Camp Chicago Dec 2012 - All presentationsCloud Camp Chicago Dec 2012 - All presentations
Cloud Camp Chicago Dec 2012 - All presentations
 
Nodejs presentation
Nodejs presentationNodejs presentation
Nodejs presentation
 
Building businesspost.ie using Node.js
Building businesspost.ie using Node.jsBuilding businesspost.ie using Node.js
Building businesspost.ie using Node.js
 
Node js crash course session 1
Node js crash course   session 1Node js crash course   session 1
Node js crash course session 1
 
Basic Concept of Node.js & NPM
Basic Concept of Node.js & NPMBasic Concept of Node.js & NPM
Basic Concept of Node.js & NPM
 
What are some misconceptions about node js
What are some misconceptions about node jsWhat are some misconceptions about node js
What are some misconceptions about node js
 
Node.js - Introduction and role in Frontend Development
Node.js - Introduction and role in Frontend DevelopmentNode.js - Introduction and role in Frontend Development
Node.js - Introduction and role in Frontend Development
 
Node js presentation
Node js presentationNode js presentation
Node js presentation
 
All You Need to Know About Using Node.pdf
All You Need to Know About Using Node.pdfAll You Need to Know About Using Node.pdf
All You Need to Know About Using Node.pdf
 
Tool review
Tool reviewTool review
Tool review
 
02 Node introduction
02 Node introduction02 Node introduction
02 Node introduction
 
Toppling Domino - 44CON 4012
Toppling Domino - 44CON 4012Toppling Domino - 44CON 4012
Toppling Domino - 44CON 4012
 
Exploring Next Generation Buildpacks - Anand Rao & Scott Deeg
Exploring Next Generation Buildpacks - Anand Rao & Scott DeegExploring Next Generation Buildpacks - Anand Rao & Scott Deeg
Exploring Next Generation Buildpacks - Anand Rao & Scott Deeg
 
Node.js and Enterprise Web Apps: Know all About it
Node.js and Enterprise Web Apps: Know all About itNode.js and Enterprise Web Apps: Know all About it
Node.js and Enterprise Web Apps: Know all About it
 
What is Node.js_ Pros and Cons of Node.js Web App Development
What is Node.js_ Pros and Cons of Node.js Web App DevelopmentWhat is Node.js_ Pros and Cons of Node.js Web App Development
What is Node.js_ Pros and Cons of Node.js Web App Development
 
What is Node.js_ Pros and Cons of Node.js Web App Development.pdf
What is Node.js_ Pros and Cons of Node.js Web App Development.pdfWhat is Node.js_ Pros and Cons of Node.js Web App Development.pdf
What is Node.js_ Pros and Cons of Node.js Web App Development.pdf
 
What to expect while building your first nodeJS application
What to expect while building your first nodeJS applicationWhat to expect while building your first nodeJS application
What to expect while building your first nodeJS application
 
Drupal Cloud to the rescue? Servers, Files, CDNs and Fun!
Drupal Cloud to the rescue? Servers, Files, CDNs and Fun!Drupal Cloud to the rescue? Servers, Files, CDNs and Fun!
Drupal Cloud to the rescue? Servers, Files, CDNs and Fun!
 
Unity Loves HelNode - Helsinki Node.js November Meetup
Unity Loves HelNode - Helsinki Node.js November MeetupUnity Loves HelNode - Helsinki Node.js November Meetup
Unity Loves HelNode - Helsinki Node.js November Meetup
 

Más de Claudio Cicali

Más de Claudio Cicali (6)

JavaScript pitfalls
JavaScript pitfallsJavaScript pitfalls
JavaScript pitfalls
 
An introduction to the web
An introduction to the webAn introduction to the web
An introduction to the web
 
Node.js – Convincing the boss
Node.js – Convincing the bossNode.js – Convincing the boss
Node.js – Convincing the boss
 
Drupal + Apache SOLR
Drupal + Apache SOLRDrupal + Apache SOLR
Drupal + Apache SOLR
 
Introduzione a OpenID
Introduzione a OpenIDIntroduzione a OpenID
Introduzione a OpenID
 
Youryoutube
YouryoutubeYouryoutube
Youryoutube
 

Último

Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 

Último (20)

Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 

Introduction to NodeJS

  • 1. What the frak is Node JS? NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 2. Claudio Cicali @caludio Front-end engineer at SponsorPay NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 3. Installing NodeJS Download, unpack, make, make install ... or use homebrew (and yes! It works on Windows too) NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 4. JavaScript is an interpreted language which means that you need an JavaScript interpreter to run your programs We often refer to these beasts as JavaScript Engines or JavaScript Virtual Machine NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 5. Every browser has its own VM Firefox? Spidermonkey Internet Explorer? Chakra Chrome? V8 Safari? JavaScriptCore Opera? Carakan Also Rhino, stand alone NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 6. 2009: this guy had an idea (he is Ryan Dahl, btw) NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 7. Make no mistake NodeJS is NOT a “one man project” It is backed by Joyent, which is a big player in the cloud computing business (has money and people) NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 8. If you already can write JavaScript in the browser why can’t you write JavaScript on the server then? NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 9. js VMs are getting better and better Get one of them, include some additional libraries and wrap it up into a powerful, directly executable JavaScript platform NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 10. After the idea, the design: Google V8 would have been the VM (Tried using Spidermonkey, no luck) Monoprocess, no threads Completely event driven (asynchronous, non-blocking) Focus on NETWORKING NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 11. What is the “Node Standard Library”? A set of ready-to-use tools which gives you - a powerful HTTP(S) library (client and server in no time) - DNS name resolution - Crypto - access to the file system - URL manipulation - ZLIB - UDP datagrams http://nodejs.org/docs/latest/api/ NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 12. Those tools can JavaScript only or mixed with some C or C++ for performances reason NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 13. Now we have a platform to write REAL programs (i.e.: no sandboxing) in JavaScript The JavaScript itself - oh, joy - it’s the latest stable V8 AND NO COMPATIBILITY LAYER! (cries) except ... NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 14. ... except for Node JS itself With every new major version, you might loose compatibility at the API level (the Node standard library) (this is really more of a youth problem, anyway) NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 15. Node JS is fast, in theory Low maintencance (small impact on resources) Programs must not stress the CPU Programming is not THAT easy API are well documented NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 16. The Node JS standard library can be EXTENDED by the use of modules This is serious business: the number of available modules is HUGE (and the quality? Well...) NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 17. MODULES in NodeJS use a well known pattern/paradigm/standard: CommonJS (which is well known thanks to... NodeJS) Writing a module is easy Maybe too much :) (oh, and you’d write “addons” in C/C++ as well) NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 18. Take a look: https://github.com/joyent/node/wiki/modules NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 19. Module management is EASY with https://npmjs.org/ No need to install it: comes with Node! (Node >= 0.6) With brew you need to run npmjs.org/install.sh NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 20. Need to access MySQL from your program? npm install mysql NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 21. Publishing your module to the world is freacking easy too (no moderation, no approval...) npm publish NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 22. Modules can be of any complexity Connect is a big “middleware” module which gives you cookies, sessions, logging, caching... Express is a web framework built on top of Connect NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 23. What “using modules” means //  The  “fs”  module  is  ready  to  use var  fs  =  require(“fs”); fs.open(“somefile”,  “r”,  function(error)  { //  Do  something  with  the  file }); NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 24. claudioc$  npm  install  sqlite //  Once  installed  the  “sqlite”  module  is //  ready  to  use var  sqlite  =  require(“sqlite”); var  db  =  new  sqlite.Database(); db.open(“my_db”,  function(error)  { //  Do  something  with  the  database }); NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 25. There are libraries which run in the browser AND in NodeJS as modules (transparently) “As of 3.5.0, YUI runs natively on Node.js and comes with an official npm package for easy installation.” NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 26. What can NodeJS be used for then? Network servers (HTTP, Proxies, messaging) API backends Real time applications Streaming data “One page” web sites Command line tools Bots NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 27. NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 28. Let me introduce you a couple of things I’ve done with NodeJS NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 29. antipad.com Real time collaborative code editor Built on the giants’ shoulders: The ACE editor (awesome) The ShareJS library (super awesome) NodeJS (lovely) NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 30. jecho “Poor man” command line remote debugger for mobile devices https://github.com/claudioc/jecho NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 31. I want moar! http://www.nodebeginner.org/ (highly recommended) http://nodetoolbox.com http://nodeguide.com NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 32. Follow me! @caludio NodeJS - © Claudio Cicali Tuesday, December 4, 2012
  • 33. One more thing “The guys that are getting paid the big bucks to deliver scalable solutions aren’t up at night feverishly rewriting their systems in Node. They’re doing what they’ve always done: measuring, testing, benchmarking, thinking hard, keeping up with the academic literature that pertains to their problems.” -- Alex Payne http://al3x.net/2010/07/27/node.html NodeJS - © Claudio Cicali Tuesday, December 4, 2012