2. Click to edit Master text styles
What is Node.Js ?
Node.js is a JavaScript runtime, built on Chrome's V8 JavaScript
engine.
Node.js uses an event-driven, non-blocking I/O model that makes it
lightweight and efficient.
Node.js' package ecosystem, npm, is the largest ecosystem of open
source libraries in the world.
3. Click to edit Master text styles
The Creator
“Ryan Dahl is an American freelance programmer living in Germany.
His work invariably involves interruptible parsers, event loops, and
response time histograms. He is the creator of several open source
projects including the Ebb web server and the "EY" load balancer
module for Nginx.”
4. Click to edit Master text styles
Install NodeJS on your machine
Go to https://nodejs.org.
Starting a node project
5. Click to edit Master text styles
Syntax Convections
The error-first pattern was used into Node
• The first argument of the callback is reserved for an error object
• The second argument of the callback is reserved for any successful response data.
DEFINING AN ERROR-FIRST CALLBACK
6. Click to edit Master text styles
How do NodeJS Works ?
• NodeJS Console :
Node.js comes with virtual environment called REPL (aka Node shell). REPL stands for Read-Eval-Print-Loop.
• V8 Engine runs on the machine
7. Click to edit Master text styles
How do NodeJS Works ?
• Architecture :
8. Click to edit Master text styles
How do NodeJS Works ? Example
9. Click to edit Master text styles
How do NodeJS Works ? Example
11. Click to edit Master text styles
Chrome's V8 JavaScript engine
It handles memory allocation and garbage collection.
Read more: http://thibaultlaurens.github.io/javascript/2013/04/29/how-the-v8-engine-works/
Google’s V8 engine, written in C++, compiles and executes
JavaScript source code.
Its design consists of two compilers that compile source code
directly into machine code. –Full Codegen, -CrankShift
A JavaScript engine is a program or library which executes
JavaScript code.
12. Click to edit Master text styles
Do we have other JavaScript engines ?
Browser, Headless Browser, or Runtime JavaScript Engine
Mozilla Spidermonkey
Chrome V8
Safari JavaScriptCore / Nitro
IE and Edge Chakra
PhantomJS JavaScriptCore
HTMLUnit Rhino
TrifleJS V8
Node.js V8
Io.js V8
13. Click to edit Master text styles
What are its alternatives ?
• github.com/reactor/reactor (jvm)
• vertx.io (jvm)
• coolio.github.io (ruby)
• github.com/blesh/ALE (.net)
• reactphp.org (php)
• cyclone.io (python)
14. Click to edit Master text styles
Why is it becoming popular?
• High-Performance
• Easy to modify and maintain
• Productivity
• Reduce the number of servers needed to serve customers
• Data Intensive Real Apps
15. Click to edit Master text styles
Application Areas for Node.js
• The Internet of Things
• E-Commerce
• Payment Processing
• Social Media
• Realtime Services
• Media
• Enterprise Web Service
16. Click to edit Master text styles
Who all are using NodeJs
17. Click to edit Master text styles
What is NPM ?
It is also a command-line utility for interacting with
repository that aids in package installation, version
management, and dependency management
It is an online repository for the publishing of open-
source Node.js projects
Short for Node Package Manager
Basically it is the package manager for node. It
helps with installing various packages and
resolving their various dependencies
18. Click to edit Master text styles
What is NPM ?
https://www.npmjs.com/
19. Click to edit Master text styles
What are some well known Frameworks?
• Node.js Express. ...
• Sail.js (node.js mvc) ...
• KOA. ...
• Meteor - Full Stack Node.js Framework. ...
• Derby.js. ...
• Flatiron.js (Node.js MVC Framework) ...
• Hapi - Node.js Web Application Framework. ...
• Mean.IO - Node.js Application Framework.
20. Click to edit Master text styles
Express JS
• inspired by the Ruby project 'Sinatra‘
• most popular
• Allows to set up middlewares to respond to HTTP Requests.
• Defines a routing table which is used to perform different actions based on HTTP Method and URL.
• Allows to dynamically render HTML Pages based on passing arguments to templates
• Easy to learn