SlideShare a Scribd company logo
www.edureka.co/mastering-node-js
View Mastering Node.js course details at www.edureka.co/mastering-node-js
Node JS Express - Steps to create Restful Web App
Slide 2 www.edureka.co/mastering-node-js
LIVE Online Class
Class Recording in LMS
24/7 Post Class Support
Module Wise Quiz
Project Work
Verifiable Certificate
Course Features
Slide 3 www.edureka.co/mastering-node-js
Objectives
At the end of the session you will be able to learn:
NPM
Node.js Express
Templates in Express
Creating Restful Web App
Slide 4 www.edureka.co/mastering-node-jsSlide 4
What is Node.js ?
Node.js is an open source, cross-platform runtime environment for server-side and networking applications
Node.js applications are written in JavaScript, and can be run within the Node.js runtime on OS X, Microsoft
Windows, Linux, FreeBSD, NonStop and IBM. -- Wikipedia
This is based on Google’s V8 JavaScript Engine
Slide 5 www.edureka.co/mastering-node-jsSlide 5
What is Node.js ? (Contd.)
Guess What ?
» IT’s SINGLE THREADED !!
» No worries about : race conditions, deadlocks and other problems that go with multi-threading.
» “Almost no function in Node directly performs I/O, so the process never blocks. Because nothing blocks,
less-than-expert programmers are able to develop scalable systems.” - (courtesy : nodejs.org)
Event
Loop
Event
Queue
Thread Pool
file system
network
process
other
Slide 6 www.edureka.co/mastering-node-jsSlide 6
Basics of Node.js : npm
npm used to stand for Node Package Manager. However it is not an acronym anymore. npm is not a Node.js
specific tool
npm is a registry of reusable modules and packages written by various developers
» Yes, you can publish your own npm packages
There are two ways to install npm packages :
» Locally : To use and depend on the package from your own module or project
» Globally: To use across the system, like a command line tool
Slide 7 www.edureka.co/mastering-node-jsSlide 7
Use-Cases of Node.js
1. Walmart executives believe that the benefit of using Node.js was
far greater than any risk in adopting a new technology
2. They re-engineered their mobile app to run on Node.js where all
the front end code gets executed on back-end
3. “We rely on services all over the world,” says Almaer (V.P Mobile
Architecture) “We do not control all of those services. Node
allows us to front all these services… and scale up very nicely.
It’s perfect for what we’re doing in mobile.”
Server Side Web Applications
1. Server Side Web Applications
Advantages
Slide 8 www.edureka.co/mastering-node-jsSlide 8
Use-Cases of Node.js (Contd.)
1. Linkedin is also leaning heavily on Node.js (Linkedin mobile and
tablet app is 95% html/web based)
2. “We’re still full-on Node. We are excited that it can scale,” says
Kiran Prasad (Head of Linkedin’s Mobile Development Team).
“Over the past few months, we’ve made performance tweaks so
we can scale even more. On four boxes, we can now handle 20
times the load we were handling before.”
Highly Scalable
1. Server Side Web Applications
2. Highly Scalable
Advantages
Slide 9 www.edureka.co/mastering-node-jsSlide 9
Use-Cases of Node.js (Contd.)
1. When he first built Voxer, Matt Ranney (Voxer’s CTO) ran a test
to see how many connections he could open on a single server.
"I just decided to open as many connections as I could, just to
see where things would fall down," Ranney says
2. "With Node, I could open, well, all of them. I couldn't open any
more connections without getting more IP addresses on my test
machine. Node uses such small amounts of memory, it's
astounding. I ran out of port numbers."
Low Memory Consumption
1. Server Side Web Applications
2. Highly Scalable
3. Low Memory Consumption
Advantages
Slide 10 www.edureka.co/mastering-node-jsSlide 10
Express JS
Express JS : Web Framework for Node.js. It is an npm package
To install : npm install -g express //in the main project folder
Express JS also provides a tool to create a simple folder structure for your app :
» Now, saying express newapp will create a project called newapp in the current working directory along
with a simple folder structure.
» The dependencies will then be installed by doing a cd newapp and then npm install
» To run the app
» node app // This is where the server is run and listening on a port
Slide 11 www.edureka.co/mastering-node-jsSlide 11
Express JS : Templates
By default Express supports the Jade Template Engine for the HTML Views.
What is an Javascript Template Engine : it is a framework to help bind data to your HTML views
Why do you need one ?
» Helps you easily bind data from the back end with the HTML view
» Helps in bundling HTML code into reusable modules/layouts
» Adds basic conditionals & iterations / loops to your HTML. HTML does not support “If -Else” or “for”
loops.
Many Javascript Template Engines are available : Jade, Handlebars, Hogan, EJS, etc.
Slide 12 www.edureka.co/mastering-node-jsSlide 12
Express JS : Jade
Jade is a simple Javascript Template engine for writing HTML. No config has to be set up for ExpressJS
since it is the default view engine
 It supports dynamic code, template inheritance and allows you to compile templates into reusable
functions that can run on server
Example of Jade syntax :
JADE
html
head
title My App Title
body
h1= pageHeaderVar
div.className
p.
some
content
HTML
<html>
<head>
<title> My App Title
</title>
</head>
<body>
<h1>Page Header</h1>
<div class=”className”>
<p>
some
content
</p>
</div>
</body>
</html>
Slide 13 www.edureka.co/mastering-node-jsSlide 13
Express JS : A Simple Express Application
var express = require(‘express’);
var app = express();
app.get(‘/’,function(req,res){
res.send(‘Hello World !!”);
})
app.listen(3000,function(){
console.log(‘Express Server listening on port 3000);
})
Slide 14 www.edureka.co/mastering-node-jsSlide 14
Job Trends
Salaries for Node.js Developers are already in the $60,000 range and much more.
From the graph below : The number of jobs are skyrocketing.
Slide 15 www.edureka.co/mastering-node-js
DEMO
Slide 16 www.edureka.co/mastering-node-js
Course Topics
→ Module 7
» Forks, Spawns and the Process Module
→ Module 8
» Testing in Node.js
→ Module 9
» Node.js in the Tech World
→ Module 1
» Introduction to Objects in Javascript & Node.js
→ Module 2
» Modules / Packages
→ Module 3
» Events & Streams
→ Module 4
» Network Communication & Web Technology in
Node.js
→ Module 5
» Building a Web Application
→ Module 6
» Real-time Communication
Slide 17 www.edureka.co/mastering-node-js
Questions
Slide 18 www.edureka.co/mastering-node-js

More Related Content

What's hot (20)

PDF
Communication in Node.js
Edureka!
 
PPTX
Reactjs Introduction - Virtual DOM
Tamir Azrab
 
PPTX
Node js introduction
Joseph de Castelnau
 
PPT
Node js
Chirag Parmar
 
PDF
EWD 3 Training Course Part 15: Using a Framework other than jQuery with QEWD
Rob Tweed
 
PDF
High Performance JavaScript - jQuery Conference SF Bay Area 2010
Nicholas Zakas
 
PDF
Node.js Crash Course
David Neal
 
PPTX
Vuejs getting-started - Extended Version
Murat Doğan
 
PDF
Node.js & Twitter Bootstrap Crash Course
Aaron Silverman
 
PDF
[1D1]신개념 N스크린 웹 앱 프레임워크 PARS
NAVER D2
 
PDF
EWD 3 Training Course Part 27: The QEWD Session
Rob Tweed
 
PDF
Composable and streamable Play apps
Yevgeniy Brikman
 
PPTX
Gruntwork Executive Summary
Yevgeniy Brikman
 
PPTX
Enough with the JavaScript already!
Nicholas Zakas
 
ODP
HTTP, JSON, JavaScript, Map&Reduce built-in to MySQL
Ulf Wendel
 
PDF
Node.js vs Play Framework
Yevgeniy Brikman
 
PDF
The curious Life of JavaScript - Talk at SI-SE 2015
jbandi
 
PDF
Max Voloshin - "Organization of frontend development for products with micros...
IT Event
 
PDF
JavaScript Interview Questions and Answers | Full Stack Web Development Train...
Edureka!
 
PPTX
High Performance Snippets
Steve Souders
 
Communication in Node.js
Edureka!
 
Reactjs Introduction - Virtual DOM
Tamir Azrab
 
Node js introduction
Joseph de Castelnau
 
Node js
Chirag Parmar
 
EWD 3 Training Course Part 15: Using a Framework other than jQuery with QEWD
Rob Tweed
 
High Performance JavaScript - jQuery Conference SF Bay Area 2010
Nicholas Zakas
 
Node.js Crash Course
David Neal
 
Vuejs getting-started - Extended Version
Murat Doğan
 
Node.js & Twitter Bootstrap Crash Course
Aaron Silverman
 
[1D1]신개념 N스크린 웹 앱 프레임워크 PARS
NAVER D2
 
EWD 3 Training Course Part 27: The QEWD Session
Rob Tweed
 
Composable and streamable Play apps
Yevgeniy Brikman
 
Gruntwork Executive Summary
Yevgeniy Brikman
 
Enough with the JavaScript already!
Nicholas Zakas
 
HTTP, JSON, JavaScript, Map&Reduce built-in to MySQL
Ulf Wendel
 
Node.js vs Play Framework
Yevgeniy Brikman
 
The curious Life of JavaScript - Talk at SI-SE 2015
jbandi
 
Max Voloshin - "Organization of frontend development for products with micros...
IT Event
 
JavaScript Interview Questions and Answers | Full Stack Web Development Train...
Edureka!
 
High Performance Snippets
Steve Souders
 

Viewers also liked (20)

PDF
Node js
Rohan Chandane
 
PDF
Building A Web App In 100% JavaScript with Carl Bergenhem
FITC
 
PDF
Node.js – ask us anything!
Dev_Events
 
PPTX
Pengenalan Dasar NodeJS
alfi setyadi
 
PDF
Node js (runtime environment + js library) platform
Sreenivas Kappala
 
PDF
Mengembangkan Solusi Cloud dengan PaaS
The World Bank
 
PDF
Introduction to node js - From "hello world" to deploying on azure
Colin Mackay
 
PPTX
NodeJS - Server Side JS
Ganesh Kondal
 
PDF
Introduction to Node.JS Express
Eueung Mulyana
 
PDF
Node Js, AngularJs and Express Js Tutorial
PHP Support
 
PPTX
EAIESB TIBCO EXPERTISE
Vijay Reddy
 
PDF
NodeJS_Presentation
Arpita Patel
 
PPTX
Mule ESB session day 1
kkk_f17
 
PDF
Enterprise Integration Patterns
Oleg Tsal-Tsalko
 
PPT
Managing Patient SatLEADfor4-25-13
alfred lopez
 
PDF
All aboard the NodeJS Express
David Boyer
 
PPTX
Introduction to Node js
Akshay Mathur
 
PPTX
Module design pattern i.e. express js
Ahmed Assaf
 
PDF
Patterns for Enterprise Integration Success
WSO2
 
PDF
Enterprise Integration Patterns
Johan Aludden
 
Building A Web App In 100% JavaScript with Carl Bergenhem
FITC
 
Node.js – ask us anything!
Dev_Events
 
Pengenalan Dasar NodeJS
alfi setyadi
 
Node js (runtime environment + js library) platform
Sreenivas Kappala
 
Mengembangkan Solusi Cloud dengan PaaS
The World Bank
 
Introduction to node js - From "hello world" to deploying on azure
Colin Mackay
 
NodeJS - Server Side JS
Ganesh Kondal
 
Introduction to Node.JS Express
Eueung Mulyana
 
Node Js, AngularJs and Express Js Tutorial
PHP Support
 
EAIESB TIBCO EXPERTISE
Vijay Reddy
 
NodeJS_Presentation
Arpita Patel
 
Mule ESB session day 1
kkk_f17
 
Enterprise Integration Patterns
Oleg Tsal-Tsalko
 
Managing Patient SatLEADfor4-25-13
alfred lopez
 
All aboard the NodeJS Express
David Boyer
 
Introduction to Node js
Akshay Mathur
 
Module design pattern i.e. express js
Ahmed Assaf
 
Patterns for Enterprise Integration Success
WSO2
 
Enterprise Integration Patterns
Johan Aludden
 
Ad

Similar to Node JS Express: Steps to Create Restful Web App (20)

PPTX
Node JS Express : Steps to Create Restful Web App
Edureka!
 
PDF
Day In A Life Of A Node.js Developer
Edureka!
 
PDF
Day in a life of a node.js developer
Edureka!
 
PDF
All You Need to Know About Using Node.pdf
iDataScientists
 
PPTX
Building Applications With the MEAN Stack
Nir Noy
 
PDF
Node.js.pdf
gulfam ali
 
PPTX
Node js Introduction
sanskriti agarwal
 
PPTX
Nodejs
dssprakash
 
PPTX
Java script framework
Debajani Mohanty
 
PDF
React Js vs Node Js_ Which Framework to Choose for Your Next Web Application
adityakumar2080
 
PPTX
02 Node introduction
Ahmed Elbassel
 
PDF
Practical Node js Building Real World Scalable Web Apps 1st Edition Azat Mard...
seneydomanp1
 
PPTX
Basic Concept of Node.js & NPM
Bhargav Anadkat
 
PDF
Beginning MEAN Stack
Rob Davarnia
 
DOCX
Understanding Node.js and Django.docx
Savior_Marketing
 
PPTX
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JSFestUA
 
PDF
8 Best Ways To Boost Node.js Performance Of Your Application!.pdf
Sufalam Technologies
 
PDF
Isomorphic JavaScript: #DevBeat Master Class
Spike Brehm
 
Node JS Express : Steps to Create Restful Web App
Edureka!
 
Day In A Life Of A Node.js Developer
Edureka!
 
Day in a life of a node.js developer
Edureka!
 
All You Need to Know About Using Node.pdf
iDataScientists
 
Building Applications With the MEAN Stack
Nir Noy
 
Node.js.pdf
gulfam ali
 
Node js Introduction
sanskriti agarwal
 
Nodejs
dssprakash
 
Java script framework
Debajani Mohanty
 
React Js vs Node Js_ Which Framework to Choose for Your Next Web Application
adityakumar2080
 
02 Node introduction
Ahmed Elbassel
 
Practical Node js Building Real World Scalable Web Apps 1st Edition Azat Mard...
seneydomanp1
 
Basic Concept of Node.js & NPM
Bhargav Anadkat
 
Beginning MEAN Stack
Rob Davarnia
 
Understanding Node.js and Django.docx
Savior_Marketing
 
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JSFestUA
 
8 Best Ways To Boost Node.js Performance Of Your Application!.pdf
Sufalam Technologies
 
Isomorphic JavaScript: #DevBeat Master Class
Spike Brehm
 
Ad

More from Edureka! (20)

PDF
What to learn during the 21 days Lockdown | Edureka
Edureka!
 
PDF
Top 10 Dying Programming Languages in 2020 | Edureka
Edureka!
 
PDF
Top 5 Trending Business Intelligence Tools | Edureka
Edureka!
 
PDF
Tableau Tutorial for Data Science | Edureka
Edureka!
 
PDF
Python Programming Tutorial | Edureka
Edureka!
 
PDF
Top 5 PMP Certifications | Edureka
Edureka!
 
PDF
Top Maven Interview Questions in 2020 | Edureka
Edureka!
 
PDF
Linux Mint Tutorial | Edureka
Edureka!
 
PDF
How to Deploy Java Web App in AWS| Edureka
Edureka!
 
PDF
Importance of Digital Marketing | Edureka
Edureka!
 
PDF
RPA in 2020 | Edureka
Edureka!
 
PDF
Email Notifications in Jenkins | Edureka
Edureka!
 
PDF
EA Algorithm in Machine Learning | Edureka
Edureka!
 
PDF
Cognitive AI Tutorial | Edureka
Edureka!
 
PDF
AWS Cloud Practitioner Tutorial | Edureka
Edureka!
 
PDF
Blue Prism Top Interview Questions | Edureka
Edureka!
 
PDF
Big Data on AWS Tutorial | Edureka
Edureka!
 
PDF
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Edureka!
 
PDF
Kubernetes Installation on Ubuntu | Edureka
Edureka!
 
PDF
Introduction to DevOps | Edureka
Edureka!
 
What to learn during the 21 days Lockdown | Edureka
Edureka!
 
Top 10 Dying Programming Languages in 2020 | Edureka
Edureka!
 
Top 5 Trending Business Intelligence Tools | Edureka
Edureka!
 
Tableau Tutorial for Data Science | Edureka
Edureka!
 
Python Programming Tutorial | Edureka
Edureka!
 
Top 5 PMP Certifications | Edureka
Edureka!
 
Top Maven Interview Questions in 2020 | Edureka
Edureka!
 
Linux Mint Tutorial | Edureka
Edureka!
 
How to Deploy Java Web App in AWS| Edureka
Edureka!
 
Importance of Digital Marketing | Edureka
Edureka!
 
RPA in 2020 | Edureka
Edureka!
 
Email Notifications in Jenkins | Edureka
Edureka!
 
EA Algorithm in Machine Learning | Edureka
Edureka!
 
Cognitive AI Tutorial | Edureka
Edureka!
 
AWS Cloud Practitioner Tutorial | Edureka
Edureka!
 
Blue Prism Top Interview Questions | Edureka
Edureka!
 
Big Data on AWS Tutorial | Edureka
Edureka!
 
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Edureka!
 
Kubernetes Installation on Ubuntu | Edureka
Edureka!
 
Introduction to DevOps | Edureka
Edureka!
 

Recently uploaded (20)

PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
Digital Circuits, important subject in CS
contactparinay1
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 

Node JS Express: Steps to Create Restful Web App

  • 1. www.edureka.co/mastering-node-js View Mastering Node.js course details at www.edureka.co/mastering-node-js Node JS Express - Steps to create Restful Web App
  • 2. Slide 2 www.edureka.co/mastering-node-js LIVE Online Class Class Recording in LMS 24/7 Post Class Support Module Wise Quiz Project Work Verifiable Certificate Course Features
  • 3. Slide 3 www.edureka.co/mastering-node-js Objectives At the end of the session you will be able to learn: NPM Node.js Express Templates in Express Creating Restful Web App
  • 4. Slide 4 www.edureka.co/mastering-node-jsSlide 4 What is Node.js ? Node.js is an open source, cross-platform runtime environment for server-side and networking applications Node.js applications are written in JavaScript, and can be run within the Node.js runtime on OS X, Microsoft Windows, Linux, FreeBSD, NonStop and IBM. -- Wikipedia This is based on Google’s V8 JavaScript Engine
  • 5. Slide 5 www.edureka.co/mastering-node-jsSlide 5 What is Node.js ? (Contd.) Guess What ? » IT’s SINGLE THREADED !! » No worries about : race conditions, deadlocks and other problems that go with multi-threading. » “Almost no function in Node directly performs I/O, so the process never blocks. Because nothing blocks, less-than-expert programmers are able to develop scalable systems.” - (courtesy : nodejs.org) Event Loop Event Queue Thread Pool file system network process other
  • 6. Slide 6 www.edureka.co/mastering-node-jsSlide 6 Basics of Node.js : npm npm used to stand for Node Package Manager. However it is not an acronym anymore. npm is not a Node.js specific tool npm is a registry of reusable modules and packages written by various developers » Yes, you can publish your own npm packages There are two ways to install npm packages : » Locally : To use and depend on the package from your own module or project » Globally: To use across the system, like a command line tool
  • 7. Slide 7 www.edureka.co/mastering-node-jsSlide 7 Use-Cases of Node.js 1. Walmart executives believe that the benefit of using Node.js was far greater than any risk in adopting a new technology 2. They re-engineered their mobile app to run on Node.js where all the front end code gets executed on back-end 3. “We rely on services all over the world,” says Almaer (V.P Mobile Architecture) “We do not control all of those services. Node allows us to front all these services… and scale up very nicely. It’s perfect for what we’re doing in mobile.” Server Side Web Applications 1. Server Side Web Applications Advantages
  • 8. Slide 8 www.edureka.co/mastering-node-jsSlide 8 Use-Cases of Node.js (Contd.) 1. Linkedin is also leaning heavily on Node.js (Linkedin mobile and tablet app is 95% html/web based) 2. “We’re still full-on Node. We are excited that it can scale,” says Kiran Prasad (Head of Linkedin’s Mobile Development Team). “Over the past few months, we’ve made performance tweaks so we can scale even more. On four boxes, we can now handle 20 times the load we were handling before.” Highly Scalable 1. Server Side Web Applications 2. Highly Scalable Advantages
  • 9. Slide 9 www.edureka.co/mastering-node-jsSlide 9 Use-Cases of Node.js (Contd.) 1. When he first built Voxer, Matt Ranney (Voxer’s CTO) ran a test to see how many connections he could open on a single server. "I just decided to open as many connections as I could, just to see where things would fall down," Ranney says 2. "With Node, I could open, well, all of them. I couldn't open any more connections without getting more IP addresses on my test machine. Node uses such small amounts of memory, it's astounding. I ran out of port numbers." Low Memory Consumption 1. Server Side Web Applications 2. Highly Scalable 3. Low Memory Consumption Advantages
  • 10. Slide 10 www.edureka.co/mastering-node-jsSlide 10 Express JS Express JS : Web Framework for Node.js. It is an npm package To install : npm install -g express //in the main project folder Express JS also provides a tool to create a simple folder structure for your app : » Now, saying express newapp will create a project called newapp in the current working directory along with a simple folder structure. » The dependencies will then be installed by doing a cd newapp and then npm install » To run the app » node app // This is where the server is run and listening on a port
  • 11. Slide 11 www.edureka.co/mastering-node-jsSlide 11 Express JS : Templates By default Express supports the Jade Template Engine for the HTML Views. What is an Javascript Template Engine : it is a framework to help bind data to your HTML views Why do you need one ? » Helps you easily bind data from the back end with the HTML view » Helps in bundling HTML code into reusable modules/layouts » Adds basic conditionals & iterations / loops to your HTML. HTML does not support “If -Else” or “for” loops. Many Javascript Template Engines are available : Jade, Handlebars, Hogan, EJS, etc.
  • 12. Slide 12 www.edureka.co/mastering-node-jsSlide 12 Express JS : Jade Jade is a simple Javascript Template engine for writing HTML. No config has to be set up for ExpressJS since it is the default view engine  It supports dynamic code, template inheritance and allows you to compile templates into reusable functions that can run on server Example of Jade syntax : JADE html head title My App Title body h1= pageHeaderVar div.className p. some content HTML <html> <head> <title> My App Title </title> </head> <body> <h1>Page Header</h1> <div class=”className”> <p> some content </p> </div> </body> </html>
  • 13. Slide 13 www.edureka.co/mastering-node-jsSlide 13 Express JS : A Simple Express Application var express = require(‘express’); var app = express(); app.get(‘/’,function(req,res){ res.send(‘Hello World !!”); }) app.listen(3000,function(){ console.log(‘Express Server listening on port 3000); })
  • 14. Slide 14 www.edureka.co/mastering-node-jsSlide 14 Job Trends Salaries for Node.js Developers are already in the $60,000 range and much more. From the graph below : The number of jobs are skyrocketing.
  • 16. Slide 16 www.edureka.co/mastering-node-js Course Topics → Module 7 » Forks, Spawns and the Process Module → Module 8 » Testing in Node.js → Module 9 » Node.js in the Tech World → Module 1 » Introduction to Objects in Javascript & Node.js → Module 2 » Modules / Packages → Module 3 » Events & Streams → Module 4 » Network Communication & Web Technology in Node.js → Module 5 » Building a Web Application → Module 6 » Real-time Communication