SlideShare uma empresa Scribd logo
1 de 16
What is Node JS?
 A JavaScript runtime environment running Google







Chrome’s V8 engine
Node.js is a platform for building fast, scalable network
applications (web servers).
Server - side JavaScript
Uses event-driven, asynchronous I/O to minimize overhead
and maximize scalability
—Great for data-intensive, real-time applications
V8 JavaScript Engine

 V8 is written in C++ and is used in Google Chrome
 Runs on Windows (XP or newer), Mac OS X (10.5 or newer), and

Linux systems that use IA-32, x64, or ARM – you can install your
server on many devices.
What can NodeJS be used for?
 Network servers (HTTP, messaging)
 API backends
 Real time applications

 Streaming data
 Web sites
 Bots
Typical architecture
Node Package Manager (NPM)
 NPM is a package management and distribution





system for Node
you can quickly find packages to serve specific
purposes
An npm package is a directory structure with a
package.json file describing the package
Total Packages: over 31 000
can be installed simply by typing the following:
npm install moduleName
Node Package Manager (NPM)
 Databases: mysql, postgresql, mongodb
 DOM: jsdom
 Web frameworks: express, connect

 DOM Manipulation: jQuery
 Utility libraries: underscore ,backbone, request
 Templating: mustache, jade

 Testing: vows, expresso
Non-blocking I/O
 Servers do nothing but I/O (Scripts waiting on I/O

requests degrades performance )
 To avoid blocking, Node makes use of the event driven
nature of JS by attaching callbacks to I/O requests
THE NODE WAY
fs.read('very-big-file', function(data) {
complexOperation(data); }
);
// you can do a lot when waiting for data
doOtherStuff();
Blocking vs Non-Blocking flow
Basic HTTP Server
CODE:

http = require("http");
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.write(“Start Hello");
res.end('Hello Worldn');
})

 when ‘stuff’ happens my function fires
 I get a request object and a response object
 I write to the response object header HTTP status 200

(Standard response for successful HTTP requests) and
content-type ‘text/plain’
 We make changes to the response object and then these are
transmitted when we call: esponse.end();
Basic HTTP Server
 This line requires the http module that ships with Node.js and

makes it accessible through the variable http.
 var http = require("http");

server = http.createServer(function(request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World");
response.end();
}).listen(8888,”127.0.0.1”);

 We pass a function into the server which it uses to handle all

incoming requests.
 When ‘stuff’ happens call this anonymous function
 Listen on port 8888 of the ip 127.0.0.1
http.ServerRequest Object
 When listening for request events, the callback gets an

http.ServerRequest object as the first argument. This
object has methods and properties:
 req.url: This property contains the requested URL as a
string. It does not contain the schema, hostname, or
port, but it contains everything after that.
 req.method: This contains the HTTP method used on
the request. It can be, for
example, GET, POST, DELETE, or HEAD.
 req.headers: This contains an object with a property for
every HTTP header on the request.
http.ServerResponse Object
 Writing headers: res.writeHead(status, headers)
 Changing or setting a header res.setHeader(name, value);
 Writing a Piece of the Response Body:

res.write('Hello');
 or use an existing buffer:

var buffer = new Buffer('Hello World');
res.write(buffer);

 Streaming a mp4
var fs = require('fs');
require('http').createServer(function(req, res) {
res.writeHead(200, {'Content-Type': 'video/mp4'});
var rs = fs.createReadStream('test.mp4');
rs.pipe(res);

}).listen(4000);
Basic node JS Module








var mysql
= require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
user : 'nod',
password : 'nodejs',
database : "test"
});






function connectDatabase() {
connection.connect();
console.log("db connected");
}











//insert data to database and call the function received
function insertDatabase( data , callback ) {



exports.startDatabase = connectDatabase;



exports.insertDatabase = insertDatabase;;

connection.query('INSERT INTO users (user) VALUES (?)',[data.clientName], function ( err, result ) {
if (err) throw err;
//calling callback function from server-chat.js
callback ( result.insertId );
});
}
Example
 Free Spark implementation:

http://10.182.39.2/
Cosmin Mereuta

Mais conteúdo relacionado

Mais procurados

Building a real life application in node js
Building a real life application in node jsBuilding a real life application in node js
Building a real life application in node jsfakedarren
 
Node js presentation
Node js presentationNode js presentation
Node js presentationmartincabrera
 
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
 
A million connections and beyond - Node.js at scale
A million connections and beyond - Node.js at scaleA million connections and beyond - Node.js at scale
A million connections and beyond - Node.js at scaleTom Croucher
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.jsorkaplan
 
Building your first Node app with Connect & Express
Building your first Node app with Connect & ExpressBuilding your first Node app with Connect & Express
Building your first Node app with Connect & ExpressChristian Joudrey
 
Node.js Patterns for Discerning Developers
Node.js Patterns for Discerning DevelopersNode.js Patterns for Discerning Developers
Node.js Patterns for Discerning Developerscacois
 
Node.js and How JavaScript is Changing Server Programming
Node.js and How JavaScript is Changing Server Programming  Node.js and How JavaScript is Changing Server Programming
Node.js and How JavaScript is Changing Server Programming Tom Croucher
 
Server Side Event Driven Programming
Server Side Event Driven ProgrammingServer Side Event Driven Programming
Server Side Event Driven ProgrammingKamal Hussain
 
All aboard the NodeJS Express
All aboard the NodeJS ExpressAll aboard the NodeJS Express
All aboard the NodeJS ExpressDavid Boyer
 

Mais procurados (20)

Building a real life application in node js
Building a real life application in node jsBuilding a real life application in node js
Building a real life application in node js
 
Node js presentation
Node js presentationNode js presentation
Node js presentation
 
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
 
A million connections and beyond - Node.js at scale
A million connections and beyond - Node.js at scaleA million connections and beyond - Node.js at scale
A million connections and beyond - Node.js at scale
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.js
 
Building your first Node app with Connect & Express
Building your first Node app with Connect & ExpressBuilding your first Node app with Connect & Express
Building your first Node app with Connect & Express
 
NodeJS for Beginner
NodeJS for BeginnerNodeJS for Beginner
NodeJS for Beginner
 
NodeJS
NodeJSNodeJS
NodeJS
 
Node.js Patterns for Discerning Developers
Node.js Patterns for Discerning DevelopersNode.js Patterns for Discerning Developers
Node.js Patterns for Discerning Developers
 
Node ppt
Node pptNode ppt
Node ppt
 
Node.js and How JavaScript is Changing Server Programming
Node.js and How JavaScript is Changing Server Programming  Node.js and How JavaScript is Changing Server Programming
Node.js and How JavaScript is Changing Server Programming
 
Node.js in production
Node.js in productionNode.js in production
Node.js in production
 
Node.js - As a networking tool
Node.js - As a networking toolNode.js - As a networking tool
Node.js - As a networking tool
 
Server Side Event Driven Programming
Server Side Event Driven ProgrammingServer Side Event Driven Programming
Server Side Event Driven Programming
 
Node.js
Node.jsNode.js
Node.js
 
Introduction Node.js
Introduction Node.jsIntroduction Node.js
Introduction Node.js
 
Nodejs presentation
Nodejs presentationNodejs presentation
Nodejs presentation
 
Nodejs intro
Nodejs introNodejs intro
Nodejs intro
 
Nodejs - A-quick-tour-v3
Nodejs - A-quick-tour-v3Nodejs - A-quick-tour-v3
Nodejs - A-quick-tour-v3
 
All aboard the NodeJS Express
All aboard the NodeJS ExpressAll aboard the NodeJS Express
All aboard the NodeJS Express
 

Semelhante a Scalable network applications, event-driven - Node JS

Semelhante a Scalable network applications, event-driven - Node JS (20)

nodejs_at_a_glance.ppt
nodejs_at_a_glance.pptnodejs_at_a_glance.ppt
nodejs_at_a_glance.ppt
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
 
node js.pptx
node js.pptxnode js.pptx
node js.pptx
 
An Overview of Node.js
An Overview of Node.jsAn Overview of Node.js
An Overview of Node.js
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Node js getting started
Node js getting startedNode js getting started
Node js getting started
 
Node.js Workshop - Sela SDP 2015
Node.js Workshop  - Sela SDP 2015Node.js Workshop  - Sela SDP 2015
Node.js Workshop - Sela SDP 2015
 
Web Server.pdf
Web Server.pdfWeb Server.pdf
Web Server.pdf
 
Intro to Node
Intro to NodeIntro to Node
Intro to Node
 
Introduction to Node js for beginners + game project
Introduction to Node js for beginners + game projectIntroduction to Node js for beginners + game project
Introduction to Node js for beginners + game project
 
Node.js 1, 2, 3
Node.js 1, 2, 3Node.js 1, 2, 3
Node.js 1, 2, 3
 
Ajax
AjaxAjax
Ajax
 
Node.js introduction
Node.js introductionNode.js introduction
Node.js introduction
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
 
Introduction to Ajax programming
Introduction to Ajax programmingIntroduction to Ajax programming
Introduction to Ajax programming
 
Using and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middlewareUsing and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middleware
 
5.node js
5.node js5.node js
5.node js
 
08 ajax
08 ajax08 ajax
08 ajax
 
Node.js System: The Approach
Node.js System: The ApproachNode.js System: The Approach
Node.js System: The Approach
 
Node js beginner
Node js beginnerNode js beginner
Node js beginner
 

Último

Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 

Último (20)

Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

Scalable network applications, event-driven - Node JS

  • 1.
  • 2. What is Node JS?  A JavaScript runtime environment running Google     Chrome’s V8 engine Node.js is a platform for building fast, scalable network applications (web servers). Server - side JavaScript Uses event-driven, asynchronous I/O to minimize overhead and maximize scalability —Great for data-intensive, real-time applications
  • 3. V8 JavaScript Engine  V8 is written in C++ and is used in Google Chrome  Runs on Windows (XP or newer), Mac OS X (10.5 or newer), and Linux systems that use IA-32, x64, or ARM – you can install your server on many devices.
  • 4. What can NodeJS be used for?  Network servers (HTTP, messaging)  API backends  Real time applications  Streaming data  Web sites  Bots
  • 6. Node Package Manager (NPM)  NPM is a package management and distribution     system for Node you can quickly find packages to serve specific purposes An npm package is a directory structure with a package.json file describing the package Total Packages: over 31 000 can be installed simply by typing the following: npm install moduleName
  • 7. Node Package Manager (NPM)  Databases: mysql, postgresql, mongodb  DOM: jsdom  Web frameworks: express, connect  DOM Manipulation: jQuery  Utility libraries: underscore ,backbone, request  Templating: mustache, jade  Testing: vows, expresso
  • 8. Non-blocking I/O  Servers do nothing but I/O (Scripts waiting on I/O requests degrades performance )  To avoid blocking, Node makes use of the event driven nature of JS by attaching callbacks to I/O requests THE NODE WAY fs.read('very-big-file', function(data) { complexOperation(data); } ); // you can do a lot when waiting for data doOtherStuff();
  • 10. Basic HTTP Server CODE: http = require("http"); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.write(“Start Hello"); res.end('Hello Worldn'); })  when ‘stuff’ happens my function fires  I get a request object and a response object  I write to the response object header HTTP status 200 (Standard response for successful HTTP requests) and content-type ‘text/plain’  We make changes to the response object and then these are transmitted when we call: esponse.end();
  • 11. Basic HTTP Server  This line requires the http module that ships with Node.js and makes it accessible through the variable http.  var http = require("http"); server = http.createServer(function(request, response) { response.writeHead(200, {"Content-Type": "text/plain"}); response.write("Hello World"); response.end(); }).listen(8888,”127.0.0.1”);  We pass a function into the server which it uses to handle all incoming requests.  When ‘stuff’ happens call this anonymous function  Listen on port 8888 of the ip 127.0.0.1
  • 12. http.ServerRequest Object  When listening for request events, the callback gets an http.ServerRequest object as the first argument. This object has methods and properties:  req.url: This property contains the requested URL as a string. It does not contain the schema, hostname, or port, but it contains everything after that.  req.method: This contains the HTTP method used on the request. It can be, for example, GET, POST, DELETE, or HEAD.  req.headers: This contains an object with a property for every HTTP header on the request.
  • 13. http.ServerResponse Object  Writing headers: res.writeHead(status, headers)  Changing or setting a header res.setHeader(name, value);  Writing a Piece of the Response Body: res.write('Hello');  or use an existing buffer: var buffer = new Buffer('Hello World'); res.write(buffer);  Streaming a mp4 var fs = require('fs'); require('http').createServer(function(req, res) { res.writeHead(200, {'Content-Type': 'video/mp4'}); var rs = fs.createReadStream('test.mp4'); rs.pipe(res); }).listen(4000);
  • 14. Basic node JS Module        var mysql = require('mysql'); var connection = mysql.createConnection({ host : 'localhost', user : 'nod', password : 'nodejs', database : "test" });     function connectDatabase() { connection.connect(); console.log("db connected"); }          //insert data to database and call the function received function insertDatabase( data , callback ) {  exports.startDatabase = connectDatabase;  exports.insertDatabase = insertDatabase;; connection.query('INSERT INTO users (user) VALUES (?)',[data.clientName], function ( err, result ) { if (err) throw err; //calling callback function from server-chat.js callback ( result.insertId ); }); }
  • 15. Example  Free Spark implementation: http://10.182.39.2/