SlideShare a Scribd company logo
Node.js
Atul Jain
Naman Gupta
what is javascript?
nothing to do with java
a complete language
moving parts of a web
page
not just window.open()
nodejs
And then came Node.js.
JavaScript on the server,
how cool is that?
Node.js is a JavaScript
runtime built on Chrome's
V8 JavaScript engine.
Node.js uses an event-
driven, non-blocking I/O
model.
nodejs
Node.js is really two things:
a runtime environment and
a library
why nodejs?
much easier to setup and faster to code a web app in node.js than any other
MVC (models, views, controllers) framework (say, django, flask etc).
great for single page apps
Odyssey 15 website was hosted on a five lines of code server. WUT? :O
node.js is faster, (HELL YEAH!)
node in ONE loc (ONE LINE TO RULE THEM ALL)
server.js
-------------------------------------------------------------------
console.log(“Hello, Byld”);
terminal
---------------------------------------------------------------
----
$ node server.js
Hello, Byld
$
event driven
event loop: listens for events and calls a callback function once an event has been
detected
single thread
event-driven programming is application flow control that is determined by events
or changes in state.
non blocking code (for real)
var result = database.query("SELECT * FROM hugetable");
console.log("Hello World");
event-driven, asynchronous callbacks, by utilizing an event loop.
non blocking code (for real)
var result = database.query("SELECT * FROM hugetable");
console.log("Hello World");
event-driven, asynchronous callbacks, by utilizing an event loop.
database.query("SELECT * FROM hugetable", function (rows) {
var result = rows;
});
console.log("Hello World");
npm
Node.js' package
ecosystem, npm, is the
largest ecosystem of open
source libraries in the
world.
dependency tree
Ok, this stuff is boring, right?
Let’s write some real stuff.
We will now create a web application serving a
basic purpose of “file-uploading”
What will our application do?
1. The user should be able to use our web-app on their browser.
2. The user should see a welcome page on http://localhost:3000/go
3. On the above web-page, there should be a file-upload form which accepts
image files
4. On submitting the form, the user will be redirected to
http://localhost:3000/upload where user will see the uploaded image
what do we need for this?
1. To server HTTP requests - A HTTP server.
2. Our server will answer differently to requests, depending on the URL we
need some kind of router which maps requests to request /handlers.
3. We need request handlers once the server has successfully routed a URL
request.
a. This request handler should be able to handle the POST data coming through static HTML
page from our website
b. We have to store the image temporarily on the server storage and show it in the /upload.
4. Once the requested URL is routed to proper route and the incoming data is
retrieved from that request, we will show that image on next URL (‘/upload’)
let the coding begin
file upload
middlewares
app.use()
listens to the requests and runs some code selectively
example express.static
node.js is funny
https://medium.com/@c2c/nodejs-a-
quick-optimization-advice-7353b820c92e
thanks

More Related Content

PPSX
Server Side Rendering, caching and performance
PDF
Isomorphic web application
PPTX
Spring Boot Update
PDF
ServerMessaging Workflow v1.0
PDF
ServiceWorker: New game changer is coming!
PDF
General Assembly Workshop: Advanced JavaScript
PDF
Isomorphic JavaScript: #DevBeat Master Class
PDF
React server side rendering performance
Server Side Rendering, caching and performance
Isomorphic web application
Spring Boot Update
ServerMessaging Workflow v1.0
ServiceWorker: New game changer is coming!
General Assembly Workshop: Advanced JavaScript
Isomorphic JavaScript: #DevBeat Master Class
React server side rendering performance

What's hot (20)

PDF
The Evolution of Airbnb's Frontend
PDF
Node, express & sails
PPTX
Cache for community edition
PDF
Building Isomorphic Apps (JSConf.Asia 2014)
ODP
WordPress as a Platform - talk to Bristol Open Source Meetup, 2014-12-08
PDF
Isomorphic React Applications: Performance And Scalability
PPTX
Building isomorphic java script apps faster with next.js
PPTX
Module design pattern i.e. express js
PPTX
Caching and invalidating with managed store
PDF
MEAN Stack NYC Meetup 20150717: TDD Your AngularJS + Ionic Directives With jQ...
PPT
Node.js Express Framework
PDF
Grokking #9: Building a real-time and offline editing service with Couchbase
PDF
Sails.js Intro
PDF
JSConf US 2014: Building Isomorphic Apps
PDF
Server rendering-talk
PDF
Isomorphic JavaScript with Nashorn
PPT
Active Server Page(ASP)
PDF
Be Happy With Ruby on Rails - Ecosystem
ODP
A Toda Maquina Con Ruby on Rails
PPT
HTML5 Multithreading
The Evolution of Airbnb's Frontend
Node, express & sails
Cache for community edition
Building Isomorphic Apps (JSConf.Asia 2014)
WordPress as a Platform - talk to Bristol Open Source Meetup, 2014-12-08
Isomorphic React Applications: Performance And Scalability
Building isomorphic java script apps faster with next.js
Module design pattern i.e. express js
Caching and invalidating with managed store
MEAN Stack NYC Meetup 20150717: TDD Your AngularJS + Ionic Directives With jQ...
Node.js Express Framework
Grokking #9: Building a real-time and offline editing service with Couchbase
Sails.js Intro
JSConf US 2014: Building Isomorphic Apps
Server rendering-talk
Isomorphic JavaScript with Nashorn
Active Server Page(ASP)
Be Happy With Ruby on Rails - Ecosystem
A Toda Maquina Con Ruby on Rails
HTML5 Multithreading
Ad

Viewers also liked (11)

PPTX
Sai neelkanth engineers
PPTX
Saineelkanth engineers
PDF
Thomas2015_EvdenceSummary_EN
PDF
SCANDLINES PROFILE 08 2015
PDF
Andrew Gannon CV Edited copy 2
PDF
SAI NEELKANTH ENGINEERS BROUCHER
PPTX
Human rights
PDF
Email Security Threats: IT Manager's Eyes Only
PDF
THE RISING TIDE--
PDF
CURRICULUM - RESHMA MAHARAJ (9-2016)
PDF
Inspiring Sustainability
Sai neelkanth engineers
Saineelkanth engineers
Thomas2015_EvdenceSummary_EN
SCANDLINES PROFILE 08 2015
Andrew Gannon CV Edited copy 2
SAI NEELKANTH ENGINEERS BROUCHER
Human rights
Email Security Threats: IT Manager's Eyes Only
THE RISING TIDE--
CURRICULUM - RESHMA MAHARAJ (9-2016)
Inspiring Sustainability
Ad

Similar to Web with Nodejs (20)

PPTX
Kalp Corporate Node JS Perfect Guide
DOCX
Basics of node.js
PPTX
NodeJS - Server Side JS
PPTX
Scalable network applications, event-driven - Node JS
PPTX
Unit 1 Express J for mean stack and mern
PPTX
An overview of node.js
PPTX
ODP
Introduce about Nodejs - duyetdev.com
PPT
Introduction to node.js aka NodeJS
PDF
PDF
Hello world - intro to node js
PDF
All You Need to Know About Using Node.pdf
PPTX
Introduction to Node.js
PDF
540slidesofnodejsbackendhopeitworkforu.pdf
PDF
Node.js Web Development .pdf
PPTX
Node.js & Express.js Unleashed
PPTX
Introduction to Node.js
PPT
Introducción y comandos en NodeJS slodte
PDF
🚀 Node.js Simplified – A Visual Guide for Beginners!
PPTX
Introduction to node.js by jiban
Kalp Corporate Node JS Perfect Guide
Basics of node.js
NodeJS - Server Side JS
Scalable network applications, event-driven - Node JS
Unit 1 Express J for mean stack and mern
An overview of node.js
Introduce about Nodejs - duyetdev.com
Introduction to node.js aka NodeJS
Hello world - intro to node js
All You Need to Know About Using Node.pdf
Introduction to Node.js
540slidesofnodejsbackendhopeitworkforu.pdf
Node.js Web Development .pdf
Node.js & Express.js Unleashed
Introduction to Node.js
Introducción y comandos en NodeJS slodte
🚀 Node.js Simplified – A Visual Guide for Beginners!
Introduction to node.js by jiban

Recently uploaded (20)

PDF
medical staffing services at VALiNTRY
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
Reimagine Home Health with the Power of Agentic AI​
PPTX
assetexplorer- product-overview - presentation
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PPT
Introduction Database Management System for Course Database
PDF
Digital Strategies for Manufacturing Companies
PDF
Nekopoi APK 2025 free lastest update
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Introduction to Artificial Intelligence
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PPTX
Transform Your Business with a Software ERP System
PDF
top salesforce developer skills in 2025.pdf
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
medical staffing services at VALiNTRY
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PTS Company Brochure 2025 (1).pdf.......
Reimagine Home Health with the Power of Agentic AI​
assetexplorer- product-overview - presentation
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Introduction Database Management System for Course Database
Digital Strategies for Manufacturing Companies
Nekopoi APK 2025 free lastest update
Wondershare Filmora 15 Crack With Activation Key [2025
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Introduction to Artificial Intelligence
VVF-Customer-Presentation2025-Ver1.9.pptx
Navsoft: AI-Powered Business Solutions & Custom Software Development
Designing Intelligence for the Shop Floor.pdf
Odoo Companies in India – Driving Business Transformation.pdf
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Transform Your Business with a Software ERP System
top salesforce developer skills in 2025.pdf
2025 Textile ERP Trends: SAP, Odoo & Oracle

Web with Nodejs

  • 2. what is javascript? nothing to do with java a complete language moving parts of a web page not just window.open()
  • 3. nodejs And then came Node.js. JavaScript on the server, how cool is that? Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event- driven, non-blocking I/O model.
  • 4. nodejs Node.js is really two things: a runtime environment and a library
  • 5. why nodejs? much easier to setup and faster to code a web app in node.js than any other MVC (models, views, controllers) framework (say, django, flask etc). great for single page apps Odyssey 15 website was hosted on a five lines of code server. WUT? :O node.js is faster, (HELL YEAH!)
  • 6. node in ONE loc (ONE LINE TO RULE THEM ALL) server.js ------------------------------------------------------------------- console.log(“Hello, Byld”); terminal --------------------------------------------------------------- ---- $ node server.js Hello, Byld $
  • 7. event driven event loop: listens for events and calls a callback function once an event has been detected single thread event-driven programming is application flow control that is determined by events or changes in state.
  • 8. non blocking code (for real) var result = database.query("SELECT * FROM hugetable"); console.log("Hello World"); event-driven, asynchronous callbacks, by utilizing an event loop.
  • 9. non blocking code (for real) var result = database.query("SELECT * FROM hugetable"); console.log("Hello World"); event-driven, asynchronous callbacks, by utilizing an event loop. database.query("SELECT * FROM hugetable", function (rows) { var result = rows; }); console.log("Hello World");
  • 10. npm Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries in the world. dependency tree
  • 11. Ok, this stuff is boring, right? Let’s write some real stuff. We will now create a web application serving a basic purpose of “file-uploading”
  • 12. What will our application do? 1. The user should be able to use our web-app on their browser. 2. The user should see a welcome page on http://localhost:3000/go 3. On the above web-page, there should be a file-upload form which accepts image files 4. On submitting the form, the user will be redirected to http://localhost:3000/upload where user will see the uploaded image
  • 13. what do we need for this? 1. To server HTTP requests - A HTTP server. 2. Our server will answer differently to requests, depending on the URL we need some kind of router which maps requests to request /handlers. 3. We need request handlers once the server has successfully routed a URL request. a. This request handler should be able to handle the POST data coming through static HTML page from our website b. We have to store the image temporarily on the server storage and show it in the /upload. 4. Once the requested URL is routed to proper route and the incoming data is retrieved from that request, we will show that image on next URL (‘/upload’)
  • 14. let the coding begin
  • 16. middlewares app.use() listens to the requests and runs some code selectively example express.static

Editor's Notes

  • #2: start with prerequisities
  • #3: compiler, operating system, apps on JS
  • #4: In order to execute the JavaScript you intend to run in the backend, it needs to be interpreted and, well, executed. This is what Node.js does, by making use of Google’s V8 VM, the same runtime environment for JavaScript that Google Chrome uses
  • #5: In order to execute the JavaScript you intend to run in the backend, it needs to be interpreted and, well, executed. This is what Node.js does, by making use of Google’s V8 VM, the same runtime environment for JavaScript that Google Chrome uses
  • #8: event control c in terminal touch event listener in your phone
  • #9: different xxectuion from python, ruby, java etc php
  • #10: different xxectuion from python, ruby, java etc example of php When at some point in the future the database server is done and sends the result of the query, then I have to execute the anonymous function that was passed to database.query().
  • #14: Make some coding slides. http://rmdaustralia.com.au/wp-content/uploads/2014/03/nodebeginner.pdf