SlideShare a Scribd company logo
Node .js
WHO AM I ?
• An Engineering Student at the International
Institute of Technology
• Node.js Developer
• Article Writer at CodeProject.com
What is Node?
• A powerful platform to let you run JS on the
server side
• How? Uses Google’s V8 Engine
• V8 is built in C
• V8 is the fatest JS Engine on the planet
• Great way to build modern web apps on both
Client and Server side!
What Can I Do in Node?
• Anything you want!
• Chat servers, Analytics & Crazy fast backends
• Socket.io library is a wicked way to build real
time apps
• Build a social Network! LinkedIn, Dropbox all
using Node.js
What Can’t I Do in Node?
• Contradicts previous slide but
 Node.js is not a web framework i.e Sinatra
Modules for node.js make it into web
framework i.e Express
Node.js is not Multi-threaded
 A single thread to rule them all
Non-Blocking? Blocking? I’m so confused
• By introducing callbacks. Node can move on to
other requests and whenever the callback is
called, node will process is.
• You should read non-blocking code as « put
function and params in queue and fire
callback when you reach the end of the
queue »
• Blocking= return Non-Blocking= no return.
Only callbacks
Node.js runs on the event loop
• The event loop keeps on running. Checking for
new events, so it can call callbacks for those
events.
• Lets take a look at an example.
Event Loop Example
var http = require('http');
http.createServer(function (request, response)
{
response.writeHead(200);// HTTP status
response.write(‘Droidcon Tunisia')
response.end();
});
server.listen(8080);
Using Events
• So we saw in our example, whenever an HTTP
request event is fired,our callback is called.
• Node.js has a LOT of events. Lots and Lots!
• Lets see some in action.
Events Example
var http = require('http');
http.createServer();
server.on(‘request’,function(request,response) {
response.writeHead(200);// HTTP status
response.write(‘Droidcon Tunisia')
response.end();
});
Server.on(‘connection’,function(socket){
Console.log(‘New Connection’);
});
server.listen(8080);
Using Modules
• You might have noticed we’ve been using
require(‘ ’) a lot.
• Require is basically a way to import modules
to your application. Modules are basically
classes.
• They are a module of code that contain
functions which have been exported.
• Exported functions are basically public.
Using Modules
• What does require return then? The file ?
• Well no, when you require a module.It returns
a JS Object. In require(‘http’) it return the
HTTP object.
• This has functions you can call,as well as
public variables
What is Node.js
Thank you

hadrichmed@gmail.com

More Related Content

PPT
Introduction to node.js aka NodeJS
PDF
Introduction to Node.js
PPTX
Node.JS and WebSockets with Faye
PDF
DevOps <3 node.js
PDF
Node.js and Ruby
PDF
Meetup RomaJS - introduzione interattiva a Node.js - Luca Lanziani - Codemoti...
PPTX
Node js introduction
PDF
Woo: Writing a fast web server @ ELS2015
Introduction to node.js aka NodeJS
Introduction to Node.js
Node.JS and WebSockets with Faye
DevOps <3 node.js
Node.js and Ruby
Meetup RomaJS - introduzione interattiva a Node.js - Luca Lanziani - Codemoti...
Node js introduction
Woo: Writing a fast web server @ ELS2015

What's hot (20)

PDF
Node.js for beginner
PDF
Clack: glue for web apps
PDF
Getting started with node JS
PDF
Real-time Web Application with Socket.IO, Node.js, and Redis
PPTX
Introduction to node
PPTX
Node Session - 1
PPTX
NodeJS & Socket IO on Microsoft Azure Cloud Web Sites - DWX 2014
PPTX
Future of NodeJS
PPTX
Node.js tutoria for beginner
PDF
Building a REST API with Node.js and MongoDB
ODP
SockJS Intro
PPT
Node js
PPT
Ferrara Linux Day 2011
PDF
NodeJS ecosystem
PPTX
Intro to Node.js (v1)
PDF
Introduction to REST API with Node.js
PDF
Webconf nodejs-production-architecture
PPTX
JS Fest 2018. Алексей Волков. Полезные инструменты для JS разработки
PDF
Understanding Non Blocking I/O with Python
PDF
Node.js introduction
Node.js for beginner
Clack: glue for web apps
Getting started with node JS
Real-time Web Application with Socket.IO, Node.js, and Redis
Introduction to node
Node Session - 1
NodeJS & Socket IO on Microsoft Azure Cloud Web Sites - DWX 2014
Future of NodeJS
Node.js tutoria for beginner
Building a REST API with Node.js and MongoDB
SockJS Intro
Node js
Ferrara Linux Day 2011
NodeJS ecosystem
Intro to Node.js (v1)
Introduction to REST API with Node.js
Webconf nodejs-production-architecture
JS Fest 2018. Алексей Волков. Полезные инструменты для JS разработки
Understanding Non Blocking I/O with Python
Node.js introduction
Ad

Similar to What is Node.js (20)

PPTX
PPTX
Introduction to Node.js
PPTX
ODP
Introduce about Nodejs - duyetdev.com
PDF
Tech io nodejs_20130531_v0.6
PPT
PPTX
An overview of node.js
PPTX
Kalp Corporate Node JS Perfect Guide
PPTX
NodeJS - Server Side JS
PPTX
Introduction to node.js by jiban
PPT
Nodejs Intro Part One
PPT
18_Node.js.ppt
PPT
18_Node.js.ppt
PPTX
Scalable network applications, event-driven - Node JS
PPT
Introducción y comandos en NodeJS slodte
PPTX
PDF
Node.js introduction
PDF
540slidesofnodejsbackendhopeitworkforu.pdf
PPTX
Intro to node and non blocking io
PPTX
Nodejs intro
Introduction to Node.js
Introduce about Nodejs - duyetdev.com
Tech io nodejs_20130531_v0.6
An overview of node.js
Kalp Corporate Node JS Perfect Guide
NodeJS - Server Side JS
Introduction to node.js by jiban
Nodejs Intro Part One
18_Node.js.ppt
18_Node.js.ppt
Scalable network applications, event-driven - Node JS
Introducción y comandos en NodeJS slodte
Node.js introduction
540slidesofnodejsbackendhopeitworkforu.pdf
Intro to node and non blocking io
Nodejs intro
Ad

More from mohamed hadrich (12)

PDF
Professional assesment
PPT
Implentation d'une solution Cloud IAAS
PPTX
Plan de secours inormatique
PDF
Introduction into Big data
PPTX
PPTX
Cloud Computing
PPTX
IIT Microsoft Tech Club
PPTX
IIT Microsoft Tech Club
PPTX
Fetch Company's statististics from Yahoo Finance and save it info a Google Sh...
PPTX
PPTX
How to be a rock star .Net Developer
PPTX
Why we choose Skype ?
Professional assesment
Implentation d'une solution Cloud IAAS
Plan de secours inormatique
Introduction into Big data
Cloud Computing
IIT Microsoft Tech Club
IIT Microsoft Tech Club
Fetch Company's statististics from Yahoo Finance and save it info a Google Sh...
How to be a rock star .Net Developer
Why we choose Skype ?

Recently uploaded (20)

PDF
RMMM.pdf make it easy to upload and study
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
01-Introduction-to-Information-Management.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Computing-Curriculum for Schools in Ghana
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
Lesson notes of climatology university.
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Insiders guide to clinical Medicine.pdf
PPTX
GDM (1) (1).pptx small presentation for students
PDF
Complications of Minimal Access Surgery at WLH
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
RMMM.pdf make it easy to upload and study
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Final Presentation General Medicine 03-08-2024.pptx
01-Introduction-to-Information-Management.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Supply Chain Operations Speaking Notes -ICLT Program
Renaissance Architecture: A Journey from Faith to Humanism
Computing-Curriculum for Schools in Ghana
O7-L3 Supply Chain Operations - ICLT Program
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
O5-L3 Freight Transport Ops (International) V1.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025
Lesson notes of climatology university.
Microbial disease of the cardiovascular and lymphatic systems
Insiders guide to clinical Medicine.pdf
GDM (1) (1).pptx small presentation for students
Complications of Minimal Access Surgery at WLH
VCE English Exam - Section C Student Revision Booklet
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
STATICS OF THE RIGID BODIES Hibbelers.pdf

What is Node.js

  • 2. WHO AM I ? • An Engineering Student at the International Institute of Technology • Node.js Developer • Article Writer at CodeProject.com
  • 3. What is Node? • A powerful platform to let you run JS on the server side • How? Uses Google’s V8 Engine • V8 is built in C • V8 is the fatest JS Engine on the planet • Great way to build modern web apps on both Client and Server side!
  • 4. What Can I Do in Node? • Anything you want! • Chat servers, Analytics & Crazy fast backends • Socket.io library is a wicked way to build real time apps • Build a social Network! LinkedIn, Dropbox all using Node.js
  • 5. What Can’t I Do in Node? • Contradicts previous slide but  Node.js is not a web framework i.e Sinatra Modules for node.js make it into web framework i.e Express Node.js is not Multi-threaded  A single thread to rule them all
  • 6. Non-Blocking? Blocking? I’m so confused • By introducing callbacks. Node can move on to other requests and whenever the callback is called, node will process is. • You should read non-blocking code as « put function and params in queue and fire callback when you reach the end of the queue » • Blocking= return Non-Blocking= no return. Only callbacks
  • 7. Node.js runs on the event loop • The event loop keeps on running. Checking for new events, so it can call callbacks for those events. • Lets take a look at an example.
  • 8. Event Loop Example var http = require('http'); http.createServer(function (request, response) { response.writeHead(200);// HTTP status response.write(‘Droidcon Tunisia') response.end(); }); server.listen(8080);
  • 9. Using Events • So we saw in our example, whenever an HTTP request event is fired,our callback is called. • Node.js has a LOT of events. Lots and Lots! • Lets see some in action.
  • 10. Events Example var http = require('http'); http.createServer(); server.on(‘request’,function(request,response) { response.writeHead(200);// HTTP status response.write(‘Droidcon Tunisia') response.end(); }); Server.on(‘connection’,function(socket){ Console.log(‘New Connection’); }); server.listen(8080);
  • 11. Using Modules • You might have noticed we’ve been using require(‘ ’) a lot. • Require is basically a way to import modules to your application. Modules are basically classes. • They are a module of code that contain functions which have been exported. • Exported functions are basically public.
  • 12. Using Modules • What does require return then? The file ? • Well no, when you require a module.It returns a JS Object. In require(‘http’) it return the HTTP object. • This has functions you can call,as well as public variables