SlideShare una empresa de Scribd logo
1 de 21
Getting started with
What is NodeJS ?
NodeJS is a platform built on Google’s V8
javascript engine for easily building scalable
network applications.
Advantages
  Event driven
  Nonblocking I/O Model
  Perfect for data intensive real time applications
  Lightweight and efficient
More about NodeJS
Is it all about developing server side code with
Javascript ?
Javascript provides an interface to V8.
What is this buzz about Google’s V8 javascript engine ?
  Powers Google Chrome.
  Translates javascript to assembly code
  Crankshaft JIT compiler
How is NodeJS different from other scripting
paradigms like Perl/PHP/Python/Ruby on Rails?
  Non Blocking
  Single threaded
  In built event based approach
Traditional I/O
Traditional I/O
Event based Non-Blocking I/O
How Non-Blocking I/O helps ?
                                       E
var mysql = require('db-mysql');       r
new mysql.Database(                    o
{                                      r
hostname: 'localhost‘,user: 'root‘,
password: '‘, database: 'kino_badge’}).on('error', function(error) {
     console.log('ERROR: ' + error);
}).on('ready', function(server) {            On Ready
    console.log('Connected to ' + server.hostname + ' (' + server.version + ')');
}).connect(function(error){
     if(error){
                                     connected
       console.log("connection error " + error);
     }
 this.query().select('*').from('appUser').execute(function(error,rows,columns){
       if(error){
         console.log("Error: " + error);                       R
         return;
       }                                                       e
       console.log("Rows : " + JSON.stringify(rows));          s
     });                                                       u
});
                                                              l
                                                              t
Why Javascript is the chosen one ?
 Inherently single threaded.
 Functions and Closures are available as first
 class objects
 No preconceived notions about I/O
 Event orientation at its core
 Present everywhere
   Browsers
   Webkits
NodeJS community and NPM
What is NPM
  Node packaged module.
  Third party Libraries, can be used with nodejs
What all modules are available for application
development
  16762 open source libraries available, and counting.
To install dependencies using NPM
  Any package can be installed using npm install
  Full instruction set can be referred at
  https://npmjs.org/doc/install.html
NodeJS in real world !!
• Linked-In Mobile app.
• Four Square Application
Want to program in                     ?
Be event oriented
Think in terms of callbacks on event
completion and error occurrences
Design using closures and callbacks
Let’s code with
A hello world program

A http server

List files on server
How callback works ?


console.log(‘Hello’);
setTimeout(function(){      callback
 console.log(‘World’);
},2000);
Callbacks revisited..

 var http = require("http");             HTTP Module

Create Server
 http.createServer(
     function(request,response){      Callback on request
         response.writeHead(200,{'Content-Type'
   : 'text/plain'});
         response.end("Hi I am running on
   NodeJSn");
     }
 ).listen(8124,'127.0.0.1');      Listen to Port

 console.log("server running at
   http://localhost:8124");
Detailed Example
var fs = require('fs');
var express = require('express');
var app = express(); app.listen(3000);

fs.readdir('../',function(err,files){
         console.log(files.length);
});
app.get('/file/index/:user', function(request, response) {
var user_directory = request.params.user;
fs.readdir(user_directory,function(err,files){
         if(err){
                      console.log(err);
                      response.send(JSON.stringify(err));
         }else{
response.set('Content-Type', 'text/html');
var dyna_html =
  '<html><head></head><body><table style="width:100px; height;200px;border: 1px solid black;">';
for(var i=0;i<files.length;i++){
         var dyna_col = '<tr><td>'+files[i]+'</td></tr>'
         dyna_html += dyna_col;
}
 dyna_html +='</table></body></html>';
 response.send(200, dyna_html); }});});
Let’s break with NodeJS
How to break with NodeJS
  Programming modularly
  Developing larger applications
Developing for the Web



                        ExpressJS


            MVC                     REST
Simple Examples
exports.world = function(){
  return 'hello world';
                                    hello.js
};




  var hello = require('./hello');
  var sys = require('util');
  sys.puts(hello.world());
                                    app.js
Complete JavaScript EcoSystem
Developing REST based Web app with
ExpressJS
Adding persistence layer with MongoDB
Managing security with OAuth using
  Google - PassportJS
  Facebook - facebook-node-sdk
Communicating with the Client side javascript
implemented in SmartClientJS
Questions…
Alok Guha                             Hussain Pithawala

      aalokism                             hussainpw

http://in.linkedin.com/in/alokguha   http://in.linkedin.com/in/hussainpithawala

Más contenido relacionado

La actualidad más candente

Basic Concept of Node.js & NPM
Basic Concept of Node.js & NPMBasic Concept of Node.js & NPM
Basic Concept of Node.js & NPMBhargav Anadkat
 
Node.js Express
Node.js  ExpressNode.js  Express
Node.js ExpressEyal Vardi
 
Nodejs Explained with Examples
Nodejs Explained with ExamplesNodejs Explained with Examples
Nodejs Explained with ExamplesGabriele Lana
 
Angular 8
Angular 8 Angular 8
Angular 8 Sunil OS
 
How to implement internationalization (i18n) in angular application(multiple ...
How to implement internationalization (i18n) in angular application(multiple ...How to implement internationalization (i18n) in angular application(multiple ...
How to implement internationalization (i18n) in angular application(multiple ...Katy Slemon
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsRob O'Doherty
 
Angular 4 Tutorial | What's New In Angular 4 | Angular Training | Edureka
Angular 4 Tutorial | What's New In Angular 4 | Angular Training | EdurekaAngular 4 Tutorial | What's New In Angular 4 | Angular Training | Edureka
Angular 4 Tutorial | What's New In Angular 4 | Angular Training | EdurekaEdureka!
 
A Deeper look into Javascript Basics
A Deeper look into Javascript BasicsA Deeper look into Javascript Basics
A Deeper look into Javascript BasicsMindfire Solutions
 
Angular tutorial
Angular tutorialAngular tutorial
Angular tutorialRohit Gupta
 
RESTful API In Node Js using Express
RESTful API In Node Js using Express RESTful API In Node Js using Express
RESTful API In Node Js using Express Jeetendra singh
 
OpenStack Architecture
OpenStack ArchitectureOpenStack Architecture
OpenStack ArchitectureMirantis
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsVikash Singh
 
Functional Programming in Swift
Functional Programming in SwiftFunctional Programming in Swift
Functional Programming in SwiftSaugat Gautam
 
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js +  Expres...Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js +  Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...Edureka!
 
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxUnit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxMalla Reddy University
 
Intro to vue.js
Intro to vue.jsIntro to vue.js
Intro to vue.jsTechMagic
 

La actualidad más candente (20)

Basic Concept of Node.js & NPM
Basic Concept of Node.js & NPMBasic Concept of Node.js & NPM
Basic Concept of Node.js & NPM
 
Introduction Node.js
Introduction Node.jsIntroduction Node.js
Introduction Node.js
 
Node.js Express
Node.js  ExpressNode.js  Express
Node.js Express
 
Nodejs Explained with Examples
Nodejs Explained with ExamplesNodejs Explained with Examples
Nodejs Explained with Examples
 
Angular 8
Angular 8 Angular 8
Angular 8
 
How to implement internationalization (i18n) in angular application(multiple ...
How to implement internationalization (i18n) in angular application(multiple ...How to implement internationalization (i18n) in angular application(multiple ...
How to implement internationalization (i18n) in angular application(multiple ...
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Angular 4 Tutorial | What's New In Angular 4 | Angular Training | Edureka
Angular 4 Tutorial | What's New In Angular 4 | Angular Training | EdurekaAngular 4 Tutorial | What's New In Angular 4 | Angular Training | Edureka
Angular 4 Tutorial | What's New In Angular 4 | Angular Training | Edureka
 
A Deeper look into Javascript Basics
A Deeper look into Javascript BasicsA Deeper look into Javascript Basics
A Deeper look into Javascript Basics
 
TypeScript Presentation
TypeScript PresentationTypeScript Presentation
TypeScript Presentation
 
Angular tutorial
Angular tutorialAngular tutorial
Angular tutorial
 
RESTful API In Node Js using Express
RESTful API In Node Js using Express RESTful API In Node Js using Express
RESTful API In Node Js using Express
 
OpenStack Architecture
OpenStack ArchitectureOpenStack Architecture
OpenStack Architecture
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Nodejs presentation
Nodejs presentationNodejs presentation
Nodejs presentation
 
Puppeteer
PuppeteerPuppeteer
Puppeteer
 
Functional Programming in Swift
Functional Programming in SwiftFunctional Programming in Swift
Functional Programming in Swift
 
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js +  Expres...Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js +  Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
 
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptxUnit 1 - TypeScript & Introduction to Angular CLI.pptx
Unit 1 - TypeScript & Introduction to Angular CLI.pptx
 
Intro to vue.js
Intro to vue.jsIntro to vue.js
Intro to vue.js
 

Destacado

Design patterns
Design patternsDesign patterns
Design patternsAlok Guha
 
Java Script Promise
Java Script PromiseJava Script Promise
Java Script PromiseAlok Guha
 
Portfolio Undefined
Portfolio UndefinedPortfolio Undefined
Portfolio Undefined<Undefined>
 
Aglie estimation and planning
Aglie estimation and planningAglie estimation and planning
Aglie estimation and planningAlok Guha
 

Destacado (7)

Design patterns
Design patternsDesign patterns
Design patterns
 
Java Script Promise
Java Script PromiseJava Script Promise
Java Script Promise
 
Express JS
Express JSExpress JS
Express JS
 
Jasmine
JasmineJasmine
Jasmine
 
Portfolio Undefined
Portfolio UndefinedPortfolio Undefined
Portfolio Undefined
 
Q unit
Q unitQ unit
Q unit
 
Aglie estimation and planning
Aglie estimation and planningAglie estimation and planning
Aglie estimation and planning
 

Similar a NodeJS

Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineEvent-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineRicardo Silva
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applicationsTom Croucher
 
Node.js - async for the rest of us.
Node.js - async for the rest of us.Node.js - async for the rest of us.
Node.js - async for the rest of us.Mike Brevoort
 
Node js introduction
Node js introductionNode js introduction
Node js introductionAlex Su
 
node.js: Javascript's in your backend
node.js: Javascript's in your backendnode.js: Javascript's in your backend
node.js: Javascript's in your backendDavid Padbury
 
Original slides from Ryan Dahl's NodeJs intro talk
Original slides from Ryan Dahl's NodeJs intro talkOriginal slides from Ryan Dahl's NodeJs intro talk
Original slides from Ryan Dahl's NodeJs intro talkAarti Parikh
 
Introduce about Nodejs - duyetdev.com
Introduce about Nodejs - duyetdev.comIntroduce about Nodejs - duyetdev.com
Introduce about Nodejs - duyetdev.comVan-Duyet Le
 
Node js
Node jsNode js
Node jshazzaz
 
Future Decoded - Node.js per sviluppatori .NET
Future Decoded - Node.js per sviluppatori .NETFuture Decoded - Node.js per sviluppatori .NET
Future Decoded - Node.js per sviluppatori .NETGianluca Carucci
 
How and why i roll my own node.js framework
How and why i roll my own node.js frameworkHow and why i roll my own node.js framework
How and why i roll my own node.js frameworkBen Lin
 
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...GITS Indonesia
 
Why Nodejs Guilin Shanghai
Why Nodejs Guilin ShanghaiWhy Nodejs Guilin Shanghai
Why Nodejs Guilin ShanghaiJackson Tian
 
Why Node.js
Why Node.jsWhy Node.js
Why Node.jsguileen
 
Introduction to Vert.x
Introduction to Vert.xIntroduction to Vert.x
Introduction to Vert.xYiguang Hu
 

Similar a NodeJS (20)

Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineEvent-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 Engine
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.js
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
 
Node.js - async for the rest of us.
Node.js - async for the rest of us.Node.js - async for the rest of us.
Node.js - async for the rest of us.
 
Node js introduction
Node js introductionNode js introduction
Node js introduction
 
JS everywhere 2011
JS everywhere 2011JS everywhere 2011
JS everywhere 2011
 
node.js: Javascript's in your backend
node.js: Javascript's in your backendnode.js: Javascript's in your backend
node.js: Javascript's in your backend
 
Original slides from Ryan Dahl's NodeJs intro talk
Original slides from Ryan Dahl's NodeJs intro talkOriginal slides from Ryan Dahl's NodeJs intro talk
Original slides from Ryan Dahl's NodeJs intro talk
 
Introduce about Nodejs - duyetdev.com
Introduce about Nodejs - duyetdev.comIntroduce about Nodejs - duyetdev.com
Introduce about Nodejs - duyetdev.com
 
Node js
Node jsNode js
Node js
 
Event driven programming -- Node.JS
Event driven programming -- Node.JSEvent driven programming -- Node.JS
Event driven programming -- Node.JS
 
Future Decoded - Node.js per sviluppatori .NET
Future Decoded - Node.js per sviluppatori .NETFuture Decoded - Node.js per sviluppatori .NET
Future Decoded - Node.js per sviluppatori .NET
 
How and why i roll my own node.js framework
How and why i roll my own node.js frameworkHow and why i roll my own node.js framework
How and why i roll my own node.js framework
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...
Fundamental Node.js (Workshop bersama Front-end Developer GITS Indonesia, War...
 
Why Nodejs Guilin Shanghai
Why Nodejs Guilin ShanghaiWhy Nodejs Guilin Shanghai
Why Nodejs Guilin Shanghai
 
Why Node.js
Why Node.jsWhy Node.js
Why Node.js
 
Node intro
Node introNode intro
Node intro
 
node.js dao
node.js daonode.js dao
node.js dao
 
Introduction to Vert.x
Introduction to Vert.xIntroduction to Vert.x
Introduction to Vert.x
 

Último

Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 

Último (20)

Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 

NodeJS

  • 2. What is NodeJS ? NodeJS is a platform built on Google’s V8 javascript engine for easily building scalable network applications. Advantages Event driven Nonblocking I/O Model Perfect for data intensive real time applications Lightweight and efficient
  • 3. More about NodeJS Is it all about developing server side code with Javascript ? Javascript provides an interface to V8. What is this buzz about Google’s V8 javascript engine ? Powers Google Chrome. Translates javascript to assembly code Crankshaft JIT compiler How is NodeJS different from other scripting paradigms like Perl/PHP/Python/Ruby on Rails? Non Blocking Single threaded In built event based approach
  • 7. How Non-Blocking I/O helps ? E var mysql = require('db-mysql'); r new mysql.Database( o { r hostname: 'localhost‘,user: 'root‘, password: '‘, database: 'kino_badge’}).on('error', function(error) { console.log('ERROR: ' + error); }).on('ready', function(server) { On Ready console.log('Connected to ' + server.hostname + ' (' + server.version + ')'); }).connect(function(error){ if(error){ connected console.log("connection error " + error); } this.query().select('*').from('appUser').execute(function(error,rows,columns){ if(error){ console.log("Error: " + error); R return; } e console.log("Rows : " + JSON.stringify(rows)); s }); u }); l t
  • 8. Why Javascript is the chosen one ? Inherently single threaded. Functions and Closures are available as first class objects No preconceived notions about I/O Event orientation at its core Present everywhere Browsers Webkits
  • 9. NodeJS community and NPM What is NPM Node packaged module. Third party Libraries, can be used with nodejs What all modules are available for application development 16762 open source libraries available, and counting. To install dependencies using NPM Any package can be installed using npm install Full instruction set can be referred at https://npmjs.org/doc/install.html
  • 10.
  • 11. NodeJS in real world !! • Linked-In Mobile app. • Four Square Application
  • 12. Want to program in ? Be event oriented Think in terms of callbacks on event completion and error occurrences Design using closures and callbacks
  • 13. Let’s code with A hello world program A http server List files on server
  • 14. How callback works ? console.log(‘Hello’); setTimeout(function(){ callback console.log(‘World’); },2000);
  • 15. Callbacks revisited.. var http = require("http"); HTTP Module Create Server http.createServer( function(request,response){ Callback on request response.writeHead(200,{'Content-Type' : 'text/plain'}); response.end("Hi I am running on NodeJSn"); } ).listen(8124,'127.0.0.1'); Listen to Port console.log("server running at http://localhost:8124");
  • 16. Detailed Example var fs = require('fs'); var express = require('express'); var app = express(); app.listen(3000); fs.readdir('../',function(err,files){ console.log(files.length); }); app.get('/file/index/:user', function(request, response) { var user_directory = request.params.user; fs.readdir(user_directory,function(err,files){ if(err){ console.log(err); response.send(JSON.stringify(err)); }else{ response.set('Content-Type', 'text/html'); var dyna_html = '<html><head></head><body><table style="width:100px; height;200px;border: 1px solid black;">'; for(var i=0;i<files.length;i++){ var dyna_col = '<tr><td>'+files[i]+'</td></tr>' dyna_html += dyna_col; } dyna_html +='</table></body></html>'; response.send(200, dyna_html); }});});
  • 17. Let’s break with NodeJS How to break with NodeJS Programming modularly Developing larger applications Developing for the Web ExpressJS MVC REST
  • 18. Simple Examples exports.world = function(){ return 'hello world'; hello.js }; var hello = require('./hello'); var sys = require('util'); sys.puts(hello.world()); app.js
  • 19. Complete JavaScript EcoSystem Developing REST based Web app with ExpressJS Adding persistence layer with MongoDB Managing security with OAuth using Google - PassportJS Facebook - facebook-node-sdk Communicating with the Client side javascript implemented in SmartClientJS
  • 21. Alok Guha Hussain Pithawala aalokism hussainpw http://in.linkedin.com/in/alokguha http://in.linkedin.com/in/hussainpithawala