SlideShare una empresa de Scribd logo
1 de 18
node.js dao Vova Miguro
What’s it all about?
[object Object],[object Object]
How? ,[object Object]
traditional I/O var  data = file.read( ‘image.png’ ); //zzz... doSomething(data); something not right here...
async I/O file.read( ‘image.png’ , function (data){ doSomething(image); }); doSomethingElse(); profit!
callback() callback() callback()
node.js internals ,[object Object],[object Object],[object Object]
it is only one thread! ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
http server var  http = require( 'http' ); http.createServer( function  (req, res) { res.writeHead( 200 , { 'Content-Type' :  'text/plain' }); res.end( 'Hello World' ); }).listen( 3000 );
watch file var  fs = require( 'fs' ); fs.watchFile( 'system.log' , function  () { console.log( 'log changed!' ); });
 
node & mongo var  mongodb = require( 'mongodb' ); var  server =  new  Server( '127.0.0.1' ,  27017 , {}); new  Db( 'test' , server, {}).open( function  (error, client) { var  collection =  new  Collection(client,  'tmp' ); //insert doc collection.insert({a: 12 ,b: 'string' },{},function(){ //find doc collection.find({}, {limit: 10 }).toArray( function (err, docs) { //do smth with docs }); }); });
node & web sockets //server var  io = require( 'socket.io' ).listen( 80 ); io.sockets.on( 'connection' ,  function  (socket) { socket.emit( 'news' , {hello: 'world' }); }); //client var  socket = io.connect( ' http://localhost ' ); socket.on( 'news' ,  function  (data) { console.log(data); });
let’s see...
suited for... ,[object Object],[object Object],[object Object],[object Object]
do not use for this... ,[object Object],[object Object]
?

Más contenido relacionado

La actualidad más candente

node.js workshop- node.js middleware
node.js workshop- node.js middlewarenode.js workshop- node.js middleware
node.js workshop- node.js middleware
Qiong Wu
 
Scalable Socket Server by Aryo
Scalable Socket Server by AryoScalable Socket Server by Aryo
Scalable Socket Server by Aryo
Agate Studio
 
Jan Čurn: Meteor: the full-stack JavaScript framework
Jan Čurn: Meteor: the full-stack JavaScript frameworkJan Čurn: Meteor: the full-stack JavaScript framework
Jan Čurn: Meteor: the full-stack JavaScript framework
Develcz
 

La actualidad más candente (20)

node.js workshop- node.js middleware
node.js workshop- node.js middlewarenode.js workshop- node.js middleware
node.js workshop- node.js middleware
 
Create a RESTful API with NodeJS, Express and MongoDB
Create a RESTful API with NodeJS, Express and MongoDBCreate a RESTful API with NodeJS, Express and MongoDB
Create a RESTful API with NodeJS, Express and MongoDB
 
Scalable Socket Server by Aryo
Scalable Socket Server by AryoScalable Socket Server by Aryo
Scalable Socket Server by Aryo
 
Jan Čurn: Meteor: the full-stack JavaScript framework
Jan Čurn: Meteor: the full-stack JavaScript frameworkJan Čurn: Meteor: the full-stack JavaScript framework
Jan Čurn: Meteor: the full-stack JavaScript framework
 
Node.js Stream API
Node.js Stream APINode.js Stream API
Node.js Stream API
 
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 to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
All you need to know about the JavaScript event loop
All you need to know about the JavaScript event loopAll you need to know about the JavaScript event loop
All you need to know about the JavaScript event loop
 
Ferrara Linux Day 2011
Ferrara Linux Day 2011Ferrara Linux Day 2011
Ferrara Linux Day 2011
 
Make the prompt great again
Make the prompt great againMake the prompt great again
Make the prompt great again
 
IaC를 어쭙잖게 맛본 썰?! Ctrl + c/v vs Ansible
IaC를 어쭙잖게 맛본 썰?! Ctrl + c/v vs AnsibleIaC를 어쭙잖게 맛본 썰?! Ctrl + c/v vs Ansible
IaC를 어쭙잖게 맛본 썰?! Ctrl + c/v vs Ansible
 
Доклад Антона Поварова "Go in Badoo" с Golang Meetup
Доклад Антона Поварова "Go in Badoo" с Golang MeetupДоклад Антона Поварова "Go in Badoo" с Golang Meetup
Доклад Антона Поварова "Go in Badoo" с Golang Meetup
 
Будь первым
Будь первымБудь первым
Будь первым
 
Node36
Node36Node36
Node36
 
Introducing to node.js
Introducing to node.jsIntroducing to node.js
Introducing to node.js
 
Developers’ mDay 2019. - Rastko Vasiljević, SuperAdmins – Infrastructure as c...
Developers’ mDay 2019. - Rastko Vasiljević, SuperAdmins – Infrastructure as c...Developers’ mDay 2019. - Rastko Vasiljević, SuperAdmins – Infrastructure as c...
Developers’ mDay 2019. - Rastko Vasiljević, SuperAdmins – Infrastructure as c...
 
Node.js and Ruby
Node.js and RubyNode.js and Ruby
Node.js and Ruby
 
Odoo Performance Limits
Odoo Performance LimitsOdoo Performance Limits
Odoo Performance Limits
 
Comets notes
Comets notesComets notes
Comets notes
 

Destacado (6)

S 004 Border Security
S 004 Border SecurityS 004 Border Security
S 004 Border Security
 
Fashion Forecasting
Fashion ForecastingFashion Forecasting
Fashion Forecasting
 
Fashion trend forecast
Fashion trend forecastFashion trend forecast
Fashion trend forecast
 
Forecasting
ForecastingForecasting
Forecasting
 
The Fashion Channel
The Fashion ChannelThe Fashion Channel
The Fashion Channel
 
The Fashion Channel - A case Analysis
The Fashion Channel - A case AnalysisThe Fashion Channel - A case Analysis
The Fashion Channel - A case Analysis
 

Similar a Владимир Мигуро "Дао Node.js"

Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
Tom Croucher
 
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
Ben Lin
 
Matthew Eernisse, NodeJs, .toster {webdev}
Matthew Eernisse, NodeJs, .toster {webdev}Matthew Eernisse, NodeJs, .toster {webdev}
Matthew Eernisse, NodeJs, .toster {webdev}
.toster
 
Node js presentation
Node js presentationNode js presentation
Node js presentation
martincabrera
 
Node js
Node jsNode js
Node js
hazzaz
 

Similar a Владимир Мигуро "Дао Node.js" (20)

node.js dao
node.js daonode.js dao
node.js dao
 
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
 
NodeJS
NodeJSNodeJS
NodeJS
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
 
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
 
Going crazy with Node.JS and CakePHP
Going crazy with Node.JS and CakePHPGoing crazy with Node.JS and CakePHP
Going crazy with Node.JS and CakePHP
 
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.
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Web program-peformance-optimization
Web program-peformance-optimizationWeb program-peformance-optimization
Web program-peformance-optimization
 
Matthew Eernisse, NodeJs, .toster {webdev}
Matthew Eernisse, NodeJs, .toster {webdev}Matthew Eernisse, NodeJs, .toster {webdev}
Matthew Eernisse, NodeJs, .toster {webdev}
 
Node js presentation
Node js presentationNode js presentation
Node js presentation
 
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
 
About Node.js
About Node.jsAbout Node.js
About Node.js
 
NodeJS
NodeJSNodeJS
NodeJS
 
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
 
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
 
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
 
Node js
Node jsNode js
Node js
 
node.js - Fast event based web application development
node.js - Fast event based web application developmentnode.js - Fast event based web application development
node.js - Fast event based web application development
 
Node.js - A Quick Tour
Node.js - A Quick TourNode.js - A Quick Tour
Node.js - A Quick Tour
 

Más de EPAM Systems

“Xcore (library) for android platform” by Uladzimir Klyshevich
“Xcore (library) for android platform” by Uladzimir Klyshevich“Xcore (library) for android platform” by Uladzimir Klyshevich
“Xcore (library) for android platform” by Uladzimir Klyshevich
EPAM Systems
 
"Как общаться эффективнее" by Natallia Kapatsevich
"Как общаться эффективнее" by Natallia Kapatsevich"Как общаться эффективнее" by Natallia Kapatsevich
"Как общаться эффективнее" by Natallia Kapatsevich
EPAM Systems
 
"Connections: Что общего у Шотландии и Дональда Трампа?" by Yevgeniy Rozenblat
"Connections: Что общего у Шотландии и Дональда Трампа?" by Yevgeniy Rozenblat "Connections: Что общего у Шотландии и Дональда Трампа?" by Yevgeniy Rozenblat
"Connections: Что общего у Шотландии и Дональда Трампа?" by Yevgeniy Rozenblat
EPAM Systems
 
ДмитрийРадченко, "Brief introduction to dundas"
ДмитрийРадченко, "Brief introduction to dundas"ДмитрийРадченко, "Brief introduction to dundas"
ДмитрийРадченко, "Brief introduction to dundas"
EPAM Systems
 
Абрамович Максим, "Rad studio xe4"
Абрамович Максим, "Rad studio xe4"Абрамович Максим, "Rad studio xe4"
Абрамович Максим, "Rad studio xe4"
EPAM Systems
 
Miniq 11: Time management by Anton Zolotarev & Andrei Artisheuski
Miniq 11: Time management by Anton Zolotarev & Andrei ArtisheuskiMiniq 11: Time management by Anton Zolotarev & Andrei Artisheuski
Miniq 11: Time management by Anton Zolotarev & Andrei Artisheuski
EPAM Systems
 
Reporting куда как-зачем by Anton Stoliar
Reporting   куда как-зачем by Anton StoliarReporting   куда как-зачем by Anton Stoliar
Reporting куда как-зачем by Anton Stoliar
EPAM Systems
 
Pool and billiards by Olga Nikolaeva
Pool and billiards by Olga NikolaevaPool and billiards by Olga Nikolaeva
Pool and billiards by Olga Nikolaeva
EPAM Systems
 
The Way of Creating Presentations: Just do it!
The Way of Creating Presentations: Just do it!The Way of Creating Presentations: Just do it!
The Way of Creating Presentations: Just do it!
EPAM Systems
 
E-mail Communication: How and Why
E-mail Communication: How and WhyE-mail Communication: How and Why
E-mail Communication: How and Why
EPAM Systems
 
николай фролов, “Gamification“
николай фролов, “Gamification“николай фролов, “Gamification“
николай фролов, “Gamification“
EPAM Systems
 
Real time bidding by Danil Melnikov
Real time bidding by Danil MelnikovReal time bidding by Danil Melnikov
Real time bidding by Danil Melnikov
EPAM Systems
 
Никита Манько “Code review”
Никита Манько “Code review”Никита Манько “Code review”
Никита Манько “Code review”
EPAM Systems
 
Чурюканов Вячеслав, “Code simple, but not simpler”
Чурюканов Вячеслав, “Code simple, but not simpler”Чурюканов Вячеслав, “Code simple, but not simpler”
Чурюканов Вячеслав, “Code simple, but not simpler”
EPAM Systems
 
Демидюк Павел , “Continuous integration with the real traffic light in m&e of...
Демидюк Павел , “Continuous integration with the real traffic light in m&e of...Демидюк Павел , “Continuous integration with the real traffic light in m&e of...
Демидюк Павел , “Continuous integration with the real traffic light in m&e of...
EPAM Systems
 
Agile retrospectives by nick frolov miniq
Agile retrospectives by nick frolov   miniqAgile retrospectives by nick frolov   miniq
Agile retrospectives by nick frolov miniq
EPAM Systems
 
Other way to travel by Anna Lukyanenka
Other way to travel by Anna LukyanenkaOther way to travel by Anna Lukyanenka
Other way to travel by Anna Lukyanenka
EPAM Systems
 
Computer as a musical instrument by Sergey Moiseychik
Computer as a musical instrument by Sergey MoiseychikComputer as a musical instrument by Sergey Moiseychik
Computer as a musical instrument by Sergey Moiseychik
EPAM Systems
 
Антон Золотарев, Екатерина Невельская "По следам SQA days"
Антон Золотарев, Екатерина Невельская "По следам SQA days"Антон Золотарев, Екатерина Невельская "По следам SQA days"
Антон Золотарев, Екатерина Невельская "По следам SQA days"
EPAM Systems
 
Сергей Семашко "End to end test: cheap and effective"
Сергей Семашко "End to end test: cheap and effective"Сергей Семашко "End to end test: cheap and effective"
Сергей Семашко "End to end test: cheap and effective"
EPAM Systems
 

Más de EPAM Systems (20)

“Xcore (library) for android platform” by Uladzimir Klyshevich
“Xcore (library) for android platform” by Uladzimir Klyshevich“Xcore (library) for android platform” by Uladzimir Klyshevich
“Xcore (library) for android platform” by Uladzimir Klyshevich
 
"Как общаться эффективнее" by Natallia Kapatsevich
"Как общаться эффективнее" by Natallia Kapatsevich"Как общаться эффективнее" by Natallia Kapatsevich
"Как общаться эффективнее" by Natallia Kapatsevich
 
"Connections: Что общего у Шотландии и Дональда Трампа?" by Yevgeniy Rozenblat
"Connections: Что общего у Шотландии и Дональда Трампа?" by Yevgeniy Rozenblat "Connections: Что общего у Шотландии и Дональда Трампа?" by Yevgeniy Rozenblat
"Connections: Что общего у Шотландии и Дональда Трампа?" by Yevgeniy Rozenblat
 
ДмитрийРадченко, "Brief introduction to dundas"
ДмитрийРадченко, "Brief introduction to dundas"ДмитрийРадченко, "Brief introduction to dundas"
ДмитрийРадченко, "Brief introduction to dundas"
 
Абрамович Максим, "Rad studio xe4"
Абрамович Максим, "Rad studio xe4"Абрамович Максим, "Rad studio xe4"
Абрамович Максим, "Rad studio xe4"
 
Miniq 11: Time management by Anton Zolotarev & Andrei Artisheuski
Miniq 11: Time management by Anton Zolotarev & Andrei ArtisheuskiMiniq 11: Time management by Anton Zolotarev & Andrei Artisheuski
Miniq 11: Time management by Anton Zolotarev & Andrei Artisheuski
 
Reporting куда как-зачем by Anton Stoliar
Reporting   куда как-зачем by Anton StoliarReporting   куда как-зачем by Anton Stoliar
Reporting куда как-зачем by Anton Stoliar
 
Pool and billiards by Olga Nikolaeva
Pool and billiards by Olga NikolaevaPool and billiards by Olga Nikolaeva
Pool and billiards by Olga Nikolaeva
 
The Way of Creating Presentations: Just do it!
The Way of Creating Presentations: Just do it!The Way of Creating Presentations: Just do it!
The Way of Creating Presentations: Just do it!
 
E-mail Communication: How and Why
E-mail Communication: How and WhyE-mail Communication: How and Why
E-mail Communication: How and Why
 
николай фролов, “Gamification“
николай фролов, “Gamification“николай фролов, “Gamification“
николай фролов, “Gamification“
 
Real time bidding by Danil Melnikov
Real time bidding by Danil MelnikovReal time bidding by Danil Melnikov
Real time bidding by Danil Melnikov
 
Никита Манько “Code review”
Никита Манько “Code review”Никита Манько “Code review”
Никита Манько “Code review”
 
Чурюканов Вячеслав, “Code simple, but not simpler”
Чурюканов Вячеслав, “Code simple, but not simpler”Чурюканов Вячеслав, “Code simple, but not simpler”
Чурюканов Вячеслав, “Code simple, but not simpler”
 
Демидюк Павел , “Continuous integration with the real traffic light in m&e of...
Демидюк Павел , “Continuous integration with the real traffic light in m&e of...Демидюк Павел , “Continuous integration with the real traffic light in m&e of...
Демидюк Павел , “Continuous integration with the real traffic light in m&e of...
 
Agile retrospectives by nick frolov miniq
Agile retrospectives by nick frolov   miniqAgile retrospectives by nick frolov   miniq
Agile retrospectives by nick frolov miniq
 
Other way to travel by Anna Lukyanenka
Other way to travel by Anna LukyanenkaOther way to travel by Anna Lukyanenka
Other way to travel by Anna Lukyanenka
 
Computer as a musical instrument by Sergey Moiseychik
Computer as a musical instrument by Sergey MoiseychikComputer as a musical instrument by Sergey Moiseychik
Computer as a musical instrument by Sergey Moiseychik
 
Антон Золотарев, Екатерина Невельская "По следам SQA days"
Антон Золотарев, Екатерина Невельская "По следам SQA days"Антон Золотарев, Екатерина Невельская "По следам SQA days"
Антон Золотарев, Екатерина Невельская "По следам SQA days"
 
Сергей Семашко "End to end test: cheap and effective"
Сергей Семашко "End to end test: cheap and effective"Сергей Семашко "End to end test: cheap and effective"
Сергей Семашко "End to end test: cheap and effective"
 

Último

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
vu2urc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

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
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
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
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
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...
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

Владимир Мигуро "Дао Node.js"

  • 3.
  • 4.
  • 5. traditional I/O var data = file.read( ‘image.png’ ); //zzz... doSomething(data); something not right here...
  • 6. async I/O file.read( ‘image.png’ , function (data){ doSomething(image); }); doSomethingElse(); profit!
  • 8.
  • 9.
  • 10. http server var http = require( 'http' ); http.createServer( function (req, res) { res.writeHead( 200 , { 'Content-Type' : 'text/plain' }); res.end( 'Hello World' ); }).listen( 3000 );
  • 11. watch file var fs = require( 'fs' ); fs.watchFile( 'system.log' , function () { console.log( 'log changed!' ); });
  • 12.  
  • 13. node & mongo var mongodb = require( 'mongodb' ); var server = new Server( '127.0.0.1' , 27017 , {}); new Db( 'test' , server, {}).open( function (error, client) { var collection = new Collection(client, 'tmp' ); //insert doc collection.insert({a: 12 ,b: 'string' },{},function(){ //find doc collection.find({}, {limit: 10 }).toArray( function (err, docs) { //do smth with docs }); }); });
  • 14. node & web sockets //server var io = require( 'socket.io' ).listen( 80 ); io.sockets.on( 'connection' , function (socket) { socket.emit( 'news' , {hello: 'world' }); }); //client var socket = io.connect( ' http://localhost ' ); socket.on( 'news' , function (data) { console.log(data); });
  • 16.
  • 17.
  • 18. ?