NODE JS
Server Side JavaScript
Background
• V8 is an open Source JavaScript engine developed my google ,it is used in google chrome browser
• Node Js runs onV8
• It is Open Source and created in 2009
Why Node ?
“Node's goal is to provide an easy way to build scalable Network programs”
• Non Blocking I/O model
• It makes use of event loops via JavaScript’s callback functionality
• Windows, Linux, Mac
• 1 Language for Frontend and Backend
• Easy to get started.
Event Loop
Non Blocking
• Blocking
• Non-Blocking
Queued Inputs
• If you’re receiving a high amount of concurrent data, your database can become a bottleneck.
• But because database access is a blocking operation (in this case), we run into trouble.
• The solution is to acknowledge the client’s behavior before the data is truly written to the database
Node JS Modules
• Node js heavily relies on modules
• Creating an in -built module is easy, just put JS code in a separate js file and include in the code b
using require
Var module_cal = require(‘./calculator’);
• Libraries in Node js are called packages and they can be installed by typing
npm install “package_name”
• NPM (Node Package Manager ) Comes bundled with Node js installation
Node JS Modules
• Express -to make syntax and DB connections simpler
• Nodemon - to monitor Node.js and push change automatically
• Mongoskin - to make mongo queries simpler
myfirstmodule.js:
app.js:
Browser:
Node JS Modules:Examples
Example:Hello World !
What can be done with Node JS
• Create HTTP/TCP Server
• Create DNS Server
• Static File Server
• Web Chat Application
• Games or anything which sends updates to user in real-time

Nodejs

  • 1.
  • 2.
    Background • V8 isan open Source JavaScript engine developed my google ,it is used in google chrome browser • Node Js runs onV8 • It is Open Source and created in 2009
  • 3.
    Why Node ? “Node'sgoal is to provide an easy way to build scalable Network programs” • Non Blocking I/O model • It makes use of event loops via JavaScript’s callback functionality • Windows, Linux, Mac • 1 Language for Frontend and Backend • Easy to get started.
  • 4.
  • 5.
  • 6.
    Queued Inputs • Ifyou’re receiving a high amount of concurrent data, your database can become a bottleneck. • But because database access is a blocking operation (in this case), we run into trouble. • The solution is to acknowledge the client’s behavior before the data is truly written to the database
  • 7.
    Node JS Modules •Node js heavily relies on modules • Creating an in -built module is easy, just put JS code in a separate js file and include in the code b using require Var module_cal = require(‘./calculator’); • Libraries in Node js are called packages and they can be installed by typing npm install “package_name” • NPM (Node Package Manager ) Comes bundled with Node js installation
  • 8.
    Node JS Modules •Express -to make syntax and DB connections simpler • Nodemon - to monitor Node.js and push change automatically • Mongoskin - to make mongo queries simpler
  • 9.
  • 10.
  • 11.
    What can bedone with Node JS • Create HTTP/TCP Server • Create DNS Server • Static File Server • Web Chat Application • Games or anything which sends updates to user in real-time