SlideShare uma empresa Scribd logo
1 de 15
Baixar para ler offline
Nodejs How To?
nodejs.org
Where do we use it?
●   Yahoo Proxy Feed
●   XML Api
●   IP2Country Service
●   IP Spam Cop
●   Skitto
●   RTB Serving
We Started with an evil
var http = require('http');
http.createServer(function (req, res) {
 res.writeHead(200, {'Content-Type': 'text/plain'});
 res.end('Hello World ');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');
DON'T CALL ME A WEBSERVER
Why??
Coz I Can even answer what 1+1 is :P
I'm a platform with event-driven, non-blocking I/O for N/W application
development



Using Node as a Server that responds to HTTP requests is a use case :)
ARCHITECTURE
LOOP IS MY LIFE
I have only one worker [Single Threaded]

He runs in an Event Loop
  ● A Loop over a queue of events to be processed
  ● Event Loop !== setInterval

He serves the events via callbacks and Don't dare to block him, then
I will the shift to state of coma ;)
AM I ASYNC?
Ya people do believe so ;)

Scenarios
  ● I/O
  ● setInterval
  ● setTimeout
  ● process.nextTick
Quick Demo
Programming in Node
Prerequisites

  ●   Deeper understanding of javascript closures and this [We take
      it for granted :P]
  ●   Node's async behaviour
  ●   Node's module system & npm [He is the one :)]
Nodejs Module System


 ●   Inherits Common JS module system
 ●   All you require is the cached module.exports object
 ●   You have a lots of options to locate
npm

●   npm !== Node Package Manager [npm is not an acronym
    (ninaa) - may be ;)]
●   If maven is for java then npm is for node
●   npm + package.json + modules The way to write node app :)
Is coding asynchronous way hard?
We had no choice and we were left in the state below :P
Patterns and Antipatterns??
PS: All Javascript Patterns and Antipatterns apply ;)
Debugging + Monitoring :(
Trust us, It is harder than developing an App :)
Overview



           Questions !!!!!!

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

Basic Concept of Node.js & NPM
Basic Concept of Node.js & NPMBasic Concept of Node.js & NPM
Basic Concept of Node.js & NPM
 
Node.js Basics
Node.js Basics Node.js Basics
Node.js Basics
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Nodejs vatsal shah
Nodejs vatsal shahNodejs vatsal shah
Nodejs vatsal shah
 
Introduction Node.js
Introduction Node.jsIntroduction Node.js
Introduction Node.js
 
Node js Introduction
Node js IntroductionNode js Introduction
Node js Introduction
 
Node js introduction
Node js introductionNode js introduction
Node js introduction
 
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
 
Introduction to NodeJS
Introduction to NodeJSIntroduction to NodeJS
Introduction to NodeJS
 
NodeJS for Beginner
NodeJS for BeginnerNodeJS for Beginner
NodeJS for Beginner
 
Nodejs functions & modules
Nodejs functions & modulesNodejs functions & modules
Nodejs functions & modules
 
Use Node.js to create a REST API
Use Node.js to create a REST APIUse Node.js to create a REST API
Use Node.js to create a REST API
 
Node.js Express
Node.js  ExpressNode.js  Express
Node.js Express
 
Rest api with node js and express
Rest api with node js and expressRest api with node js and express
Rest api with node js and express
 
Express js
Express jsExpress js
Express js
 
NodeJS guide for beginners
NodeJS guide for beginnersNodeJS guide for beginners
NodeJS guide for beginners
 
Introduction to React JS
Introduction to React JSIntroduction to React JS
Introduction to React JS
 
Introduction to Node JS.pdf
Introduction to Node JS.pdfIntroduction to Node JS.pdf
Introduction to Node JS.pdf
 
Java EE Introduction
Java EE IntroductionJava EE Introduction
Java EE Introduction
 
What Is Express JS?
What Is Express JS?What Is Express JS?
What Is Express JS?
 

Semelhante a Node ppt

Node.js for Rubists
Node.js for RubistsNode.js for Rubists
Node.js for Rubists
Sagiv Ofek
 
Integrating Node.js with PHP
Integrating Node.js with PHPIntegrating Node.js with PHP
Integrating Node.js with PHP
Lee Boynton
 

Semelhante a Node ppt (20)

Nodejs web service for starters
Nodejs web service for startersNodejs web service for starters
Nodejs web service for starters
 
Nodejs
NodejsNodejs
Nodejs
 
An overview of node.js
An overview of node.jsAn overview of node.js
An overview of node.js
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Node.js for Rubists
Node.js for RubistsNode.js for Rubists
Node.js for Rubists
 
Shall we play a game?
Shall we play a game?Shall we play a game?
Shall we play a game?
 
Node.js streams talk
Node.js streams talkNode.js streams talk
Node.js streams talk
 
Node js for beginners
Node js for beginnersNode js for beginners
Node js for beginners
 
OSDC.no 2015 introduction to node.js workshop
OSDC.no 2015 introduction to node.js workshopOSDC.no 2015 introduction to node.js workshop
OSDC.no 2015 introduction to node.js workshop
 
SWT Tech Sharing: Node.js + Redis
SWT Tech Sharing: Node.js + RedisSWT Tech Sharing: Node.js + Redis
SWT Tech Sharing: Node.js + Redis
 
Node.js
Node.jsNode.js
Node.js
 
Nodejs
NodejsNodejs
Nodejs
 
"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell
"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell
"Node.js vs workers — A comparison of two JavaScript runtimes", James M Snell
 
Why and How You Should Move from PHP to Node.js
Why and How You Should Move from PHP to Node.jsWhy and How You Should Move from PHP to Node.js
Why and How You Should Move from PHP to Node.js
 
Integrating Node.js with PHP
Integrating Node.js with PHPIntegrating Node.js with PHP
Integrating Node.js with PHP
 
Asynchronous job queues with python-rq
Asynchronous job queues with python-rqAsynchronous job queues with python-rq
Asynchronous job queues with python-rq
 
Node
NodeNode
Node
 
Node.js essentials
 Node.js essentials Node.js essentials
Node.js essentials
 
Nodejs server lesson 3
 Nodejs server lesson 3 Nodejs server lesson 3
Nodejs server lesson 3
 
Swoole Meetup AFUP¨Montpellier 27/01/2021
Swoole   Meetup  AFUP¨Montpellier 27/01/2021Swoole   Meetup  AFUP¨Montpellier 27/01/2021
Swoole Meetup AFUP¨Montpellier 27/01/2021
 

Último

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Último (20)

Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 

Node ppt

  • 2. Where do we use it? ● Yahoo Proxy Feed ● XML Api ● IP2Country Service ● IP Spam Cop ● Skitto ● RTB Serving
  • 3. We Started with an evil var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World '); }).listen(1337, '127.0.0.1'); console.log('Server running at http://127.0.0.1:1337/');
  • 4. DON'T CALL ME A WEBSERVER Why?? Coz I Can even answer what 1+1 is :P I'm a platform with event-driven, non-blocking I/O for N/W application development Using Node as a Server that responds to HTTP requests is a use case :)
  • 6. LOOP IS MY LIFE I have only one worker [Single Threaded] He runs in an Event Loop ● A Loop over a queue of events to be processed ● Event Loop !== setInterval He serves the events via callbacks and Don't dare to block him, then I will the shift to state of coma ;)
  • 7. AM I ASYNC? Ya people do believe so ;) Scenarios ● I/O ● setInterval ● setTimeout ● process.nextTick
  • 9. Programming in Node Prerequisites ● Deeper understanding of javascript closures and this [We take it for granted :P] ● Node's async behaviour ● Node's module system & npm [He is the one :)]
  • 10. Nodejs Module System ● Inherits Common JS module system ● All you require is the cached module.exports object ● You have a lots of options to locate
  • 11. npm ● npm !== Node Package Manager [npm is not an acronym (ninaa) - may be ;)] ● If maven is for java then npm is for node ● npm + package.json + modules The way to write node app :)
  • 12. Is coding asynchronous way hard? We had no choice and we were left in the state below :P
  • 13. Patterns and Antipatterns?? PS: All Javascript Patterns and Antipatterns apply ;)
  • 14. Debugging + Monitoring :( Trust us, It is harder than developing an App :)
  • 15. Overview Questions !!!!!!