SlideShare a Scribd company logo
Introduction to Node.js®
Jitendra Kumar Patel
Saturday, January 31, 2015
Why node.js ?
“Node's goal is to
provide an easy way
to build scalable
Network programs”
• Created by Ryan Dahl in 2009
• Development && maintenance sponsored by Joyent
• Licence MIT
• Last release : 0.10.31
• Based on Google V8 Engine
• +99 000 packages
About Node.js……
Success Stories…..
● Vert.x => Polygot programming
● Akka => Scala and Java
● Tornado => Python
● Libevent => C
● EventMachine => Ruby
Another project like Node.js….
● Another Web framework
● For beginner
● Multi-thread
Node.js not……
• Traditional desktop applications have a user interface wired up with background logic
– user interfaces are based on Windows Forms, Jswing, WPF, Gtk, Qt, etc. and dependant on operating system
• On the web user interfaces are standardized
– HTML for markup
– CSS for style
– JavaScript for dynamic content
• In the past proprietary technologies existed on the web, e.g. Adobe Flash, ActiveX
– They are slowly dying
• Data is generated on the server, transferred to the client and displayed by the browser
• Server Side technologies include PHP, JSP, ASP.net, Rails, Djanog, and yes, also node.js
Development for the Web….
● REST = REpresentational State Transfer
● Not new technology
● Architectural style for client-server
REST……
● General interface
● Scalability of component interface
● Reduce latency
● Encapsulate legacy system
Goals of REST……..
● GET
● POST
● PUT
● DELETE
HTTP Method……
● POST => Create
● GET => Read
● PUT => Update
● DELETE => Delete
HTTP Method with CRUD…..
● Non Blocking I/O
● V8 Javascript Engine
● Single Thread with Event Loop
● 40,025 modules
● Windows, Linux, Mac
● 1 Language for Frontend and Backend
● Active community
Why node.js ?
• Asynchronous i/o framework
• Core in c++ on top of v8
• Rest of it in javascript
• Swiss army knife for network Related stuffs
• Can handle thousands of Concurrent connections with
Minimal overhead (cpu/memory) on a single process
• It’s NOT a web framework, and it’s also NOT a language
What is node.js?
« A platform built on
Chrome's JavaScript
runtime for easily building
fast, scalable network
applications. »
http://nodejs.org/
• Friendly callbacks
• Ubiquitous
• No I/o Primitives
• One language to RULE them all
JavaScript is well known for client-side scripts running inside the browser
node.js is JavaScript running on the server-side
SSJS -> Server-Side JavaScript
Use a language you know
Use the same language for client side and server side
Why javascript ?!!!
JavaScript Engines……
Perform asynchronous processing on single thread instead of classical multithread processing, minimize
overhead & latency, maximize scalability
Scale horizontally instead of vertically
Ideal for applications that serve a lot of requests but dont use/need lots of computational power per
request
Not so ideal for heavy calculations, e.g. massive parallel computing
Also: Less problems with concurrency
The idea behind node.js….
Node.js Event Loop
There are a couple of implications of this apparently very simple and basic model
• Avoid synchronous code at all costs because it blocks the event loop
• Which means: callbacks, callbacks, and more callbacks
Example :: Read data from file and show data
Blocking vs Non-Blocking……
● Read data from file
● Show data
● Do other tasks
var data = fs.readFileSync( “test.txt” );
console.log( data );
console.log( “Do other tasks” );
Blocking…..
● Read data from file
When read data completed, show data
● Do other tasks
fs.readFile( “test.txt”, function( err, data ) {
console.log(data);
});
Non-Blocking…… Callback
• Chat/Messaging
• Real-time Applications
• Intelligent Proxies
• High Concurrency Applications
• Communication Hubs
• Coordinators
When to use it ?
● Web application
● Websocket server
● Ad server
● Proxy server
● Streaming server
● Fast file upload client
● Any Real-time data apps
● Anything with high I/O
Node.js for….
• http://nodejs.org/ and Download tar.gz
• Extract to any directory
• $ ./configure && make install
Getting Started…..
Project informations
• Name
• Version
• Dependencies
• Licence
• Main file
Etc...
File package.json…..
● https://npmjs.org/
● # of modules = 1,21,943
Node.js Modules…..
$npm install <module name>
Install module…..
• var http = require(‘http’);
• var fs = require(‘fs’);
• var express = require(‘express’);
Using module…..
In NodeJS
Others modules…..
● express
● underscore
● request
● async
● mysql
Find more in npmjs.org…..
Favorite Modules…..
• IDEs for node.js
– online IDE like cloud9
– Eclipse with node.js plugins
– Visual Studio node.js Toolkit
– Jetbrains Webstorm
– lots of other IDEs: webmatrix, coderunner, Expresso, Atom, etc.
• Preferred : Jetbrains Webstorm & Visual Studio with node.js
Tools of the trade…..
http://expressjs.com
Express…
Middleware can:
• Execute any code.
• Make changes to the request and the response objects.
• End the request-response cycle.
• Call the next middleware in the stack.
Express As Middleware
Express Middleware Modules….
● Inspire from Sinatra
● Fast
● Flexible
● Simple
Working with Express…..
• Release stable 0.10.36 (young)
• Lots of stuffs to look at
• Lots of half backed stuffs
• Retro compatibility???
• Bad at handling staticcontents
• Bad at handling binarycontents
• Hard to find organized and authoritative informations
Some Warnings…
Jitendra Kumar Patel
www.jitendrapatel.in
jitendra.patel@iiitb.org
@bewithjitendra
facebook.com/bewithjitendrapatel
Saturday, January 31, 2015
Introducción y comandos en NodeJS slodte

More Related Content

PPT
Introduction to node.js aka NodeJS
PPT
18_Node.js.ppt
PPT
18_Node.js.ppt
KEY
An Introduction to Node.js Development with Windows Azure
PPTX
Beginners Node.js
PPTX
NodeJS Presentation
PPTX
Node js for beginners
PDF
🚀 Node.js Simplified – A Visual Guide for Beginners!
Introduction to node.js aka NodeJS
18_Node.js.ppt
18_Node.js.ppt
An Introduction to Node.js Development with Windows Azure
Beginners Node.js
NodeJS Presentation
Node js for beginners
🚀 Node.js Simplified – A Visual Guide for Beginners!

Similar to Introducción y comandos en NodeJS slodte (20)

KEY
20120306 dublin js
PDF
Tech io nodejs_20130531_v0.6
PDF
Node.js
KEY
20120802 timisoara
PPTX
Mini-Training: Node.js
PDF
Node.js 101 with Rami Sayar
PDF
Building Real-World Dojo Web Applications
PDF
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
PPTX
A brief intro to nodejs
PPSX
Node.js In The Enterprise - A Primer
PDF
FITC - Node.js 101
PPTX
Scalable server component using NodeJS & ExpressJS
PPTX
Server Side Web Development Unit 1 of Nodejs.pptx
PPTX
After the LAMP, it's time to get MEAN
PPTX
Android quick talk
PPT
Node and Azure
PPTX
NodeJS - Server Side JS
PPTX
introduction to node.js
PPTX
Top 10 frameworks of node js
20120306 dublin js
Tech io nodejs_20130531_v0.6
Node.js
20120802 timisoara
Mini-Training: Node.js
Node.js 101 with Rami Sayar
Building Real-World Dojo Web Applications
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
A brief intro to nodejs
Node.js In The Enterprise - A Primer
FITC - Node.js 101
Scalable server component using NodeJS & ExpressJS
Server Side Web Development Unit 1 of Nodejs.pptx
After the LAMP, it's time to get MEAN
Android quick talk
Node and Azure
NodeJS - Server Side JS
introduction to node.js
Top 10 frameworks of node js
Ad

Recently uploaded (20)

PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Digital Strategies for Manufacturing Companies
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPT
Introduction Database Management System for Course Database
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
medical staffing services at VALiNTRY
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
System and Network Administraation Chapter 3
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PPTX
ISO 45001 Occupational Health and Safety Management System
PPTX
CHAPTER 2 - PM Management and IT Context
PPTX
L1 - Introduction to python Backend.pptx
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
PTS Company Brochure 2025 (1).pdf.......
Navsoft: AI-Powered Business Solutions & Custom Software Development
Digital Strategies for Manufacturing Companies
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Introduction Database Management System for Course Database
Design an Analysis of Algorithms I-SECS-1021-03
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
medical staffing services at VALiNTRY
Operating system designcfffgfgggggggvggggggggg
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
How Creative Agencies Leverage Project Management Software.pdf
System and Network Administraation Chapter 3
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
ISO 45001 Occupational Health and Safety Management System
CHAPTER 2 - PM Management and IT Context
L1 - Introduction to python Backend.pptx
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PTS Company Brochure 2025 (1).pdf.......
Ad

Introducción y comandos en NodeJS slodte

  • 1. Introduction to Node.js® Jitendra Kumar Patel Saturday, January 31, 2015
  • 2. Why node.js ? “Node's goal is to provide an easy way to build scalable Network programs”
  • 3. • Created by Ryan Dahl in 2009 • Development && maintenance sponsored by Joyent • Licence MIT • Last release : 0.10.31 • Based on Google V8 Engine • +99 000 packages About Node.js……
  • 5. ● Vert.x => Polygot programming ● Akka => Scala and Java ● Tornado => Python ● Libevent => C ● EventMachine => Ruby Another project like Node.js….
  • 6. ● Another Web framework ● For beginner ● Multi-thread Node.js not……
  • 7. • Traditional desktop applications have a user interface wired up with background logic – user interfaces are based on Windows Forms, Jswing, WPF, Gtk, Qt, etc. and dependant on operating system • On the web user interfaces are standardized – HTML for markup – CSS for style – JavaScript for dynamic content • In the past proprietary technologies existed on the web, e.g. Adobe Flash, ActiveX – They are slowly dying • Data is generated on the server, transferred to the client and displayed by the browser • Server Side technologies include PHP, JSP, ASP.net, Rails, Djanog, and yes, also node.js Development for the Web….
  • 8. ● REST = REpresentational State Transfer ● Not new technology ● Architectural style for client-server REST……
  • 9. ● General interface ● Scalability of component interface ● Reduce latency ● Encapsulate legacy system Goals of REST……..
  • 10. ● GET ● POST ● PUT ● DELETE HTTP Method……
  • 11. ● POST => Create ● GET => Read ● PUT => Update ● DELETE => Delete HTTP Method with CRUD…..
  • 12. ● Non Blocking I/O ● V8 Javascript Engine ● Single Thread with Event Loop ● 40,025 modules ● Windows, Linux, Mac ● 1 Language for Frontend and Backend ● Active community Why node.js ?
  • 13. • Asynchronous i/o framework • Core in c++ on top of v8 • Rest of it in javascript • Swiss army knife for network Related stuffs • Can handle thousands of Concurrent connections with Minimal overhead (cpu/memory) on a single process • It’s NOT a web framework, and it’s also NOT a language What is node.js? « A platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. » http://nodejs.org/
  • 14. • Friendly callbacks • Ubiquitous • No I/o Primitives • One language to RULE them all JavaScript is well known for client-side scripts running inside the browser node.js is JavaScript running on the server-side SSJS -> Server-Side JavaScript Use a language you know Use the same language for client side and server side Why javascript ?!!!
  • 16. Perform asynchronous processing on single thread instead of classical multithread processing, minimize overhead & latency, maximize scalability Scale horizontally instead of vertically Ideal for applications that serve a lot of requests but dont use/need lots of computational power per request Not so ideal for heavy calculations, e.g. massive parallel computing Also: Less problems with concurrency The idea behind node.js….
  • 17. Node.js Event Loop There are a couple of implications of this apparently very simple and basic model • Avoid synchronous code at all costs because it blocks the event loop • Which means: callbacks, callbacks, and more callbacks
  • 18. Example :: Read data from file and show data Blocking vs Non-Blocking……
  • 19. ● Read data from file ● Show data ● Do other tasks var data = fs.readFileSync( “test.txt” ); console.log( data ); console.log( “Do other tasks” ); Blocking…..
  • 20. ● Read data from file When read data completed, show data ● Do other tasks fs.readFile( “test.txt”, function( err, data ) { console.log(data); }); Non-Blocking…… Callback
  • 21. • Chat/Messaging • Real-time Applications • Intelligent Proxies • High Concurrency Applications • Communication Hubs • Coordinators When to use it ?
  • 22. ● Web application ● Websocket server ● Ad server ● Proxy server ● Streaming server ● Fast file upload client ● Any Real-time data apps ● Anything with high I/O Node.js for….
  • 23. • http://nodejs.org/ and Download tar.gz • Extract to any directory • $ ./configure && make install Getting Started…..
  • 24. Project informations • Name • Version • Dependencies • Licence • Main file Etc... File package.json…..
  • 25. ● https://npmjs.org/ ● # of modules = 1,21,943 Node.js Modules…..
  • 26. $npm install <module name> Install module…..
  • 27. • var http = require(‘http’); • var fs = require(‘fs’); • var express = require(‘express’); Using module…..
  • 30. ● express ● underscore ● request ● async ● mysql Find more in npmjs.org….. Favorite Modules…..
  • 31. • IDEs for node.js – online IDE like cloud9 – Eclipse with node.js plugins – Visual Studio node.js Toolkit – Jetbrains Webstorm – lots of other IDEs: webmatrix, coderunner, Expresso, Atom, etc. • Preferred : Jetbrains Webstorm & Visual Studio with node.js Tools of the trade…..
  • 33. Middleware can: • Execute any code. • Make changes to the request and the response objects. • End the request-response cycle. • Call the next middleware in the stack. Express As Middleware
  • 35. ● Inspire from Sinatra ● Fast ● Flexible ● Simple Working with Express…..
  • 36. • Release stable 0.10.36 (young) • Lots of stuffs to look at • Lots of half backed stuffs • Retro compatibility??? • Bad at handling staticcontents • Bad at handling binarycontents • Hard to find organized and authoritative informations Some Warnings…