SlideShare une entreprise Scribd logo
1  sur  33
Télécharger pour lire hors ligne
Covering
● What is Node
● What makes Node
● What is NPM
● Why all this?
...
Hands on!
● Node.js: Hello world (cli & web)
● Express.js: Hello world
● Sails.js: Hello world
● Build a Rest API
● Test the API
● Use the API
What is Node?
Node.js® is a platform built on
Chrome's JavaScript runtime for:
● easily building fast,
● scalable network applications.
Node.js uses an:
● event-driven,
● non-blocking I/O model
that makes it lightweight and efficient, perfect for
data-intensive real-time applications that run
across distributed devices.
What is Node?
Node.js® is a platform built on
Chrome's JavaScript runtime for:
● easily building fast,
● scalable network applications.
Node.js uses an:
● event-driven,
● non-blocking I/O model
that makes it lightweight and efficient, perfect for
data-intensive real-time applications that run
across distributed devices.
It's all about non-blocking,
asynchronous architecture
What is Node?
Node.js® is a platform built on
Chrome's JavaScript runtime for:
● easily building fast,
● scalable network applications.
Node.js uses an:
● event-driven,
● non-blocking I/O model
that makes it lightweight and efficient, perfect for
data-intensive real-time applications that run
across distributed devices.
It's all about non-blocking,
asynchronous architecture
This means any activity taking
a long time to finish, such as
file access, network requests,
and database operations, are
requested and put aside until the
results are ready and returned
What is Node?
Node.js® is a platform built on
Chrome's JavaScript runtime for:
● easily building fast,
● scalable network applications.
Node.js uses an:
● event-driven,
● non-blocking I/O model
that makes it lightweight and efficient, perfect for
data-intensive real-time applications that run
across distributed devices.
Easy setup & code
What is Node?
Node.js® is a platform built on
Chrome's JavaScript runtime for:
● easily building fast,
● scalable network applications.
Node.js uses an:
● event-driven,
● non-blocking I/O model
that makes it lightweight and efficient, perfect for
data-intensive real-time applications that run
across distributed devices.
It is the server!
What is Node?
Node.js® is a platform built on
Chrome's JavaScript runtime for:
● easily building fast,
● scalable network applications.
Node.js uses an:
● event-driven,
● non-blocking I/O model
that makes it lightweight and efficient, perfect for
data-intensive real-time applications that run
across distributed devices.
It is the server!
What is Node?
Node.js® is a platform built on
Chrome's JavaScript runtime for:
● easily building fast,
● scalable network applications.
Node.js uses an:
● event-driven,
● non-blocking I/O model
that makes it lightweight and efficient, perfect for
data-intensive real-time applications that run
across distributed devices.
It is the server!
What is Node?
Node.js® is a platform built on
Chrome's JavaScript runtime for:
● easily building fast,
● scalable network applications.
Node.js uses an:
● event-driven,
● non-blocking I/O model
that makes it lightweight and efficient, perfect for
data-intensive real-time applications that run
across distributed devices.
It is the server!
What is Node?
Node.js® is a platform built on
Chrome's JavaScript runtime for:
● easily building fast,
● scalable network applications.
Node.js uses an:
● event-driven,
● non-blocking I/O model
that makes it lightweight and efficient, perfect for
data-intensive real-time applications that run
across distributed devices.
It is the server!
What is Node?
Node.js® is a platform built on
Chrome's JavaScript runtime for:
● easily building fast,
● scalable network applications.
Node.js uses an:
● event-driven,
● non-blocking I/O model
that makes it lightweight and efficient, perfect for
data-intensive real-time applications that run
across distributed devices.
It is the server!
What is Node?
Node.js® is a platform built on
Chrome's JavaScript runtime for:
● easily building fast,
● scalable network applications.
Node.js uses an:
● event-driven,
● non-blocking I/O model
that makes it lightweight and efficient, perfect for
data-intensive real-time applications that run
across distributed devices.
It is the server!
Just 1
What is Node?
Node.js® is a platform built on
Chrome's JavaScript runtime for:
● easily building fast,
● scalable network applications.
Node.js uses an:
● event-driven,
● non-blocking I/O model
that makes it lightweight and efficient, perfect for
data-intensive real-time applications that run
across distributed devices.
It is the server!
Just 1
But if your app crashs it
will bring down the server
What is Node?
Node.js® is a platform built on
Chrome's JavaScript runtime for:
● easily building fast,
● scalable network applications.
Node.js uses an:
● event-driven,
● non-blocking I/O model
that makes it lightweight and efficient, perfect for
data-intensive real-time applications that run
across distributed devices.
No polling..
just callbacks
= FAST but out of order
What is Node?
Node.js® is a platform built on
Chrome's JavaScript runtime for:
● easily building fast,
● scalable network applications.
Node.js uses an:
● event-driven,
● non-blocking I/O model
that makes it lightweight and efficient, perfect for
data-intensive real-time applications that run
across distributed devices.
No headaches with
multithreaded async I/O
Non-blocking / Asynchronous
What is
Node page manager
What is
Node page manager
NPM is a package manager for JavaScript, and is
installed by default for Node.js.
What is
Node page manager
NPM is a package manager for JavaScript, and is
installed by default for Node.js.
NPM runs through the command line and manages
dependencies for an application.
What is
Node page manager
NPM is a package manager for JavaScript, and is
installed by default for Node.js.
NPM runs through the command line and manages
dependencies for an application.
What is
Node page manager
NPM is a package manager for JavaScript, and is
installed by default for Node.js.
NPM runs through the command line and manages
dependencies for an application.
It also allows users to install Node.js applications
that are available on the npm registry.
And because of JavaScript
Mongo DB
Hand on TIME!
Installing
Mac: brew install node⎆
Linux: apt-get install nodejs⎆
Linux: apt-get install npm⎆
⎆ node -v
⎆ npm -v
Server App
⎆ Node
⎆ Console.log(“Hi”)
✎
var http = require("http");
var url = require("url");
var start = function() {
var onRequest = function(request, response) {
var pathname = url.parse(request.url).pathname;
console.log("Request for " + pathname);
response.writeHead(200, {
"Content-Type": "text/plain"
});
response.write("HackerShip");
return response.end();
};
http.createServer(onRequest).listen(8888);
return console.log("Server has started.");
};
start();
⎙ balbal.js
⎆ node balbal.js
Node is the Server..
Not a framework!
✎
var http = require("http");
var url = require("url");
var start = function() {
var onRequest = function(request, response) {
var pathname = url.parse(request.url).pathname;
console.log("Request for " + pathname);
response.writeHead(200, {
"Content-Type": "text/plain"
});
response.write("HackerShip");
return response.end();
};
http.createServer(onRequest).listen(8888);
return console.log("Server has started.");
};
start();
⎙ balbal.js
⎆ node balbal.js
Installing & Run
⎆ npm install -g express
⎆ express HS
⎆ cd HS
⎆ npm install
⎆ npm start
☺ http://localhost:3000/
HSroutesindex.js ✍
Installing & Run
⎆ npm install -g sails
⎆ sails new HS2
⎆ cd HS2
⎆ sails lift
☺ http://localhost:1337/
Auto-generate REST APIs
⎆ sails generate api messages
api/models/ … api/controllers/
www.getpostman.com
⎆ sails lift
Using REST APIs [HTML]
<form action="http://localhost:1337/messages" method="post">
Text: <input type="text" name="text"><br>
<input type="submit" value="Submit">
</form>
<script src="http://code.jquery.com/jquery-2.1.3.js"></script>
<script>
// ...
</script>
Using REST APIs [JS]
var myJSONData = '{"text":”some text”}';
$.ajax({type: 'POST',
url: 'http://localhost:1337/messages',
data: myJSONData,
success: function(data) {
alert("POSTED SUCCESSFULLY TO THE SERVER");
}, // Success Function
error: function(err){
alert(err.message);
}
}); // Ajax Call

Contenu connexe

Tendances

Nodejs getting started
Nodejs getting startedNodejs getting started
Nodejs getting startedTriet Ho
 
Web Performance & Latest in React
Web Performance & Latest in ReactWeb Performance & Latest in React
Web Performance & Latest in ReactTalentica Software
 
Introduction to node.js by jiban
Introduction to node.js by jibanIntroduction to node.js by jiban
Introduction to node.js by jibanJibanananda Sana
 
Introduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azureIntroduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azureColin Mackay
 
PHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentPHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentIrfan Maulana
 
Using JHipster for generating Angular/Spring Boot apps
Using JHipster for generating Angular/Spring Boot appsUsing JHipster for generating Angular/Spring Boot apps
Using JHipster for generating Angular/Spring Boot appsYakov Fain
 
Introduction to node.js aka NodeJS
Introduction to node.js aka NodeJSIntroduction to node.js aka NodeJS
Introduction to node.js aka NodeJSJITENDRA KUMAR PATEL
 
Create Rest API in Nodejs
Create Rest API in Nodejs Create Rest API in Nodejs
Create Rest API in Nodejs Irfan Maulana
 
Node js (runtime environment + js library) platform
Node js (runtime environment + js library) platformNode js (runtime environment + js library) platform
Node js (runtime environment + js library) platformSreenivas Kappala
 
Module design pattern i.e. express js
Module design pattern i.e. express jsModule design pattern i.e. express js
Module design pattern i.e. express jsAhmed Assaf
 
Integrating React.js Into a PHP Application
Integrating React.js Into a PHP ApplicationIntegrating React.js Into a PHP Application
Integrating React.js Into a PHP ApplicationAndrew Rota
 
MEAN Stack WeNode Barcelona Workshop
MEAN Stack WeNode Barcelona WorkshopMEAN Stack WeNode Barcelona Workshop
MEAN Stack WeNode Barcelona WorkshopValeri Karpov
 
Back to the future: Isomorphic javascript applications
Back to the future:  Isomorphic javascript applicationsBack to the future:  Isomorphic javascript applications
Back to the future: Isomorphic javascript applicationsLuciano Colosio
 
Understand How Node.js and Core Features Works
Understand How Node.js and Core Features WorksUnderstand How Node.js and Core Features Works
Understand How Node.js and Core Features WorksHengki Sihombing
 
From MEAN to the MERN Stack
From MEAN to the MERN StackFrom MEAN to the MERN Stack
From MEAN to the MERN StackTroy Miles
 

Tendances (20)

Nodejs getting started
Nodejs getting startedNodejs getting started
Nodejs getting started
 
Web Performance & Latest in React
Web Performance & Latest in ReactWeb Performance & Latest in React
Web Performance & Latest in React
 
Introduction to node.js by jiban
Introduction to node.js by jibanIntroduction to node.js by jiban
Introduction to node.js by jiban
 
Node js Introduction
Node js IntroductionNode js Introduction
Node js Introduction
 
Best node js course
Best node js courseBest node js course
Best node js course
 
Introduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azureIntroduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azure
 
PHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentPHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web Development
 
Using JHipster for generating Angular/Spring Boot apps
Using JHipster for generating Angular/Spring Boot appsUsing JHipster for generating Angular/Spring Boot apps
Using JHipster for generating Angular/Spring Boot apps
 
Getting started with node.js
Getting started with node.jsGetting started with node.js
Getting started with node.js
 
Introduction to node.js aka NodeJS
Introduction to node.js aka NodeJSIntroduction to node.js aka NodeJS
Introduction to node.js aka NodeJS
 
Create Rest API in Nodejs
Create Rest API in Nodejs Create Rest API in Nodejs
Create Rest API in Nodejs
 
Node js (runtime environment + js library) platform
Node js (runtime environment + js library) platformNode js (runtime environment + js library) platform
Node js (runtime environment + js library) platform
 
Module design pattern i.e. express js
Module design pattern i.e. express jsModule design pattern i.e. express js
Module design pattern i.e. express js
 
Node js introduction
Node js introductionNode js introduction
Node js introduction
 
Integrating React.js Into a PHP Application
Integrating React.js Into a PHP ApplicationIntegrating React.js Into a PHP Application
Integrating React.js Into a PHP Application
 
MEAN Stack WeNode Barcelona Workshop
MEAN Stack WeNode Barcelona WorkshopMEAN Stack WeNode Barcelona Workshop
MEAN Stack WeNode Barcelona Workshop
 
Back to the future: Isomorphic javascript applications
Back to the future:  Isomorphic javascript applicationsBack to the future:  Isomorphic javascript applications
Back to the future: Isomorphic javascript applications
 
Why NodeJS
Why NodeJSWhy NodeJS
Why NodeJS
 
Understand How Node.js and Core Features Works
Understand How Node.js and Core Features WorksUnderstand How Node.js and Core Features Works
Understand How Node.js and Core Features Works
 
From MEAN to the MERN Stack
From MEAN to the MERN StackFrom MEAN to the MERN Stack
From MEAN to the MERN Stack
 

Similaire à Node, express & sails

Quick introduction to nodeJs
Quick introduction to nodeJsQuick introduction to nodeJs
Quick introduction to nodeJsAram Rafeq
 
Difference between Node.js vs Java script
Difference between Node.js vs Java scriptDifference between Node.js vs Java script
Difference between Node.js vs Java scriptGhulamHussain799241
 
An Introduction to Node.js Development with Windows Azure
An Introduction to Node.js Development with Windows AzureAn Introduction to Node.js Development with Windows Azure
An Introduction to Node.js Development with Windows AzureTroy Miles
 
Introduction to node.js By Ahmed Assaf
Introduction to node.js  By Ahmed AssafIntroduction to node.js  By Ahmed Assaf
Introduction to node.js By Ahmed AssafAhmed Assaf
 
Node js Development Company - Aparajayah
Node js Development Company - AparajayahNode js Development Company - Aparajayah
Node js Development Company - AparajayahAparajayahTechnologi
 
What is Mean Stack Development ?
What is Mean Stack Development ?What is Mean Stack Development ?
What is Mean Stack Development ?Balajihope
 
8 Node.js Frameworks Every Developer Should Know [UPDATED].pptx
8 Node.js Frameworks Every Developer Should Know [UPDATED].pptx8 Node.js Frameworks Every Developer Should Know [UPDATED].pptx
8 Node.js Frameworks Every Developer Should Know [UPDATED].pptx75waytechnologies
 
Node.js In The Enterprise - A Primer
Node.js In The Enterprise - A PrimerNode.js In The Enterprise - A Primer
Node.js In The Enterprise - A PrimerNaveen S.R
 
An overview of node.js
An overview of node.jsAn overview of node.js
An overview of node.jsvaluebound
 
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
 
Understanding Node.js and Django.docx
Understanding Node.js and Django.docxUnderstanding Node.js and Django.docx
Understanding Node.js and Django.docxSavior_Marketing
 

Similaire à Node, express & sails (20)

Quick introduction to nodeJs
Quick introduction to nodeJsQuick introduction to nodeJs
Quick introduction to nodeJs
 
NodeJS and what is actually does
NodeJS and what is actually doesNodeJS and what is actually does
NodeJS and what is actually does
 
02 Node introduction
02 Node introduction02 Node introduction
02 Node introduction
 
Node.js.pdf
Node.js.pdfNode.js.pdf
Node.js.pdf
 
Difference between Node.js vs Java script
Difference between Node.js vs Java scriptDifference between Node.js vs Java script
Difference between Node.js vs Java script
 
Beginners Node.js
Beginners Node.jsBeginners Node.js
Beginners Node.js
 
Nodejs
NodejsNodejs
Nodejs
 
An Introduction to Node.js Development with Windows Azure
An Introduction to Node.js Development with Windows AzureAn Introduction to Node.js Development with Windows Azure
An Introduction to Node.js Development with Windows Azure
 
Node js
Node jsNode js
Node js
 
Introduction to node.js By Ahmed Assaf
Introduction to node.js  By Ahmed AssafIntroduction to node.js  By Ahmed Assaf
Introduction to node.js By Ahmed Assaf
 
Node js Development Company - Aparajayah
Node js Development Company - AparajayahNode js Development Company - Aparajayah
Node js Development Company - Aparajayah
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
What is node.js
What is node.jsWhat is node.js
What is node.js
 
What is Mean Stack Development ?
What is Mean Stack Development ?What is Mean Stack Development ?
What is Mean Stack Development ?
 
8 Node.js Frameworks Every Developer Should Know [UPDATED].pptx
8 Node.js Frameworks Every Developer Should Know [UPDATED].pptx8 Node.js Frameworks Every Developer Should Know [UPDATED].pptx
8 Node.js Frameworks Every Developer Should Know [UPDATED].pptx
 
Node.js In The Enterprise - A Primer
Node.js In The Enterprise - A PrimerNode.js In The Enterprise - A Primer
Node.js In The Enterprise - A Primer
 
An overview of node.js
An overview of node.jsAn overview of node.js
An overview of node.js
 
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
 
Understanding Node.js and Django.docx
Understanding Node.js and Django.docxUnderstanding Node.js and Django.docx
Understanding Node.js and Django.docx
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 

Plus de Brian Shannon

Plus de Brian Shannon (6)

Go live or go home
Go live or go homeGo live or go home
Go live or go home
 
Leadership tip
Leadership tipLeadership tip
Leadership tip
 
Product tips
Product tipsProduct tips
Product tips
 
Coder tips
Coder tipsCoder tips
Coder tips
 
Founder tips
Founder tipsFounder tips
Founder tips
 
Processing
ProcessingProcessing
Processing
 

Dernier

9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 

Dernier (20)

9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 

Node, express & sails

  • 1.
  • 2. Covering ● What is Node ● What makes Node ● What is NPM ● Why all this? ...
  • 3. Hands on! ● Node.js: Hello world (cli & web) ● Express.js: Hello world ● Sails.js: Hello world ● Build a Rest API ● Test the API ● Use the API
  • 4. What is Node? Node.js® is a platform built on Chrome's JavaScript runtime for: ● easily building fast, ● scalable network applications. Node.js uses an: ● event-driven, ● non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.
  • 5. What is Node? Node.js® is a platform built on Chrome's JavaScript runtime for: ● easily building fast, ● scalable network applications. Node.js uses an: ● event-driven, ● non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices. It's all about non-blocking, asynchronous architecture
  • 6. What is Node? Node.js® is a platform built on Chrome's JavaScript runtime for: ● easily building fast, ● scalable network applications. Node.js uses an: ● event-driven, ● non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices. It's all about non-blocking, asynchronous architecture This means any activity taking a long time to finish, such as file access, network requests, and database operations, are requested and put aside until the results are ready and returned
  • 7. What is Node? Node.js® is a platform built on Chrome's JavaScript runtime for: ● easily building fast, ● scalable network applications. Node.js uses an: ● event-driven, ● non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices. Easy setup & code
  • 8. What is Node? Node.js® is a platform built on Chrome's JavaScript runtime for: ● easily building fast, ● scalable network applications. Node.js uses an: ● event-driven, ● non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices. It is the server!
  • 9. What is Node? Node.js® is a platform built on Chrome's JavaScript runtime for: ● easily building fast, ● scalable network applications. Node.js uses an: ● event-driven, ● non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices. It is the server!
  • 10. What is Node? Node.js® is a platform built on Chrome's JavaScript runtime for: ● easily building fast, ● scalable network applications. Node.js uses an: ● event-driven, ● non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices. It is the server!
  • 11. What is Node? Node.js® is a platform built on Chrome's JavaScript runtime for: ● easily building fast, ● scalable network applications. Node.js uses an: ● event-driven, ● non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices. It is the server!
  • 12. What is Node? Node.js® is a platform built on Chrome's JavaScript runtime for: ● easily building fast, ● scalable network applications. Node.js uses an: ● event-driven, ● non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices. It is the server!
  • 13. What is Node? Node.js® is a platform built on Chrome's JavaScript runtime for: ● easily building fast, ● scalable network applications. Node.js uses an: ● event-driven, ● non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices. It is the server!
  • 14. What is Node? Node.js® is a platform built on Chrome's JavaScript runtime for: ● easily building fast, ● scalable network applications. Node.js uses an: ● event-driven, ● non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices. It is the server! Just 1
  • 15. What is Node? Node.js® is a platform built on Chrome's JavaScript runtime for: ● easily building fast, ● scalable network applications. Node.js uses an: ● event-driven, ● non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices. It is the server! Just 1 But if your app crashs it will bring down the server
  • 16. What is Node? Node.js® is a platform built on Chrome's JavaScript runtime for: ● easily building fast, ● scalable network applications. Node.js uses an: ● event-driven, ● non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices. No polling.. just callbacks = FAST but out of order
  • 17. What is Node? Node.js® is a platform built on Chrome's JavaScript runtime for: ● easily building fast, ● scalable network applications. Node.js uses an: ● event-driven, ● non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices. No headaches with multithreaded async I/O
  • 19. What is Node page manager
  • 20. What is Node page manager NPM is a package manager for JavaScript, and is installed by default for Node.js.
  • 21. What is Node page manager NPM is a package manager for JavaScript, and is installed by default for Node.js. NPM runs through the command line and manages dependencies for an application.
  • 22. What is Node page manager NPM is a package manager for JavaScript, and is installed by default for Node.js. NPM runs through the command line and manages dependencies for an application.
  • 23. What is Node page manager NPM is a package manager for JavaScript, and is installed by default for Node.js. NPM runs through the command line and manages dependencies for an application. It also allows users to install Node.js applications that are available on the npm registry.
  • 24. And because of JavaScript Mongo DB
  • 26. Installing Mac: brew install node⎆ Linux: apt-get install nodejs⎆ Linux: apt-get install npm⎆ ⎆ node -v ⎆ npm -v Server App ⎆ Node ⎆ Console.log(“Hi”)
  • 27. ✎ var http = require("http"); var url = require("url"); var start = function() { var onRequest = function(request, response) { var pathname = url.parse(request.url).pathname; console.log("Request for " + pathname); response.writeHead(200, { "Content-Type": "text/plain" }); response.write("HackerShip"); return response.end(); }; http.createServer(onRequest).listen(8888); return console.log("Server has started."); }; start(); ⎙ balbal.js ⎆ node balbal.js Node is the Server.. Not a framework!
  • 28. ✎ var http = require("http"); var url = require("url"); var start = function() { var onRequest = function(request, response) { var pathname = url.parse(request.url).pathname; console.log("Request for " + pathname); response.writeHead(200, { "Content-Type": "text/plain" }); response.write("HackerShip"); return response.end(); }; http.createServer(onRequest).listen(8888); return console.log("Server has started."); }; start(); ⎙ balbal.js ⎆ node balbal.js
  • 29. Installing & Run ⎆ npm install -g express ⎆ express HS ⎆ cd HS ⎆ npm install ⎆ npm start ☺ http://localhost:3000/ HSroutesindex.js ✍
  • 30. Installing & Run ⎆ npm install -g sails ⎆ sails new HS2 ⎆ cd HS2 ⎆ sails lift ☺ http://localhost:1337/
  • 31. Auto-generate REST APIs ⎆ sails generate api messages api/models/ … api/controllers/ www.getpostman.com ⎆ sails lift
  • 32. Using REST APIs [HTML] <form action="http://localhost:1337/messages" method="post"> Text: <input type="text" name="text"><br> <input type="submit" value="Submit"> </form> <script src="http://code.jquery.com/jquery-2.1.3.js"></script> <script> // ... </script>
  • 33. Using REST APIs [JS] var myJSONData = '{"text":”some text”}'; $.ajax({type: 'POST', url: 'http://localhost:1337/messages', data: myJSONData, success: function(data) { alert("POSTED SUCCESSFULLY TO THE SERVER"); }, // Success Function error: function(err){ alert(err.message); } }); // Ajax Call