Your SlideShare is downloading. ×
  • Like
Devcamp nodejs-2010
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Devcamp nodejs-2010

  • 1,306 views
Published

Доклад о Node.js на Devcamp.by

Доклад о Node.js на Devcamp.by

Published in Technology , News & Politics
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
1,306
On SlideShare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
16
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Node.js Возможности и перспективы Antono Vasiljev http://antono.info/ http://github.com/antono/ http://groups.google.com/group/ru-nodejs/
  • 2. Краткая история всего ¥Chromium (Сентябрь 2008) ¥СommonJS (Январь 2009) ¥Node.js (Февраль 2009)
  • 3. Задача Node.js: To provide a purely evented, non-blocking infrastructure to script highly concurrent programs. http://nodejs.org/
  • 4. System Threads vs Single Thread
  • 5. Apache
  • 6. Node.js
  • 7. Событийная, асинхронная модель обработки данных
  • 8. Операции ввода-вывода унифицированы реализуют интерфейс Stream
  • 9. Объекты выполняющие I/O регистрируют обработчики событий
  • 10. И вызывают их...
  • 11. $.get('ajax/test.html', function(data) { $('.result').html(data); alert('Load was performed.'); });
  • 12. $.ajax({ url: 'ajax/test.html', success: function(data) { $('.result').html(data); alert('Load was performed.'); }, error: function() {}, complete: function() {}, beforeSend: function() {} });
  • 13. var http = require('http'); var google = http.createClient(80, 'www.google.com'); var request = google.request('GET', '/', {'host': 'www.google.com'}); request.end(); request.on('response', function (response) { console.log('STATUS: ' + response.statusCode); console.log('HEADERS: ' + JSON.stringify(response.headers)); response.setEncoding('utf8'); response.on('data', function (chunk) { console.log('BODY: ' + chunk); }); });
  • 14. JavaScript на сервере Наше все ;)
  • 15. Повторное исползование кода на клиенте http://requirejs.org
  • 16. Что уже готово?
  • 17. PostgreSQL MySQL Redis MongoDB CouchDB Sqilte
  • 18. Cucumber Selenium Jasmine JSpec Vovs
  • 19. Express Pintura Geddy
  • 20. Socket.io и Nordstream var http = require('http'), io = require('socket.io') server = http.createServer(function(req, res){ res.writeHeader(200, {'Content-Type': 'text/html'}); res.writeBody('<h1>Hello world</h1>'); res.finish(); }); // socket.io var socket = io.listen(server); socket.on('connection', function(client){ // new client is here! client.on('message', function(){ … }) client.on('disconnect', function(){ … }) });
  • 21. var socket = new io.Socket(); socket.on('connect', function(){ socket.send('hi!'); }) socket.on('message', function(data){ alert(data); }) socket.on('disconnect', function(){})
  • 22. Nordstream var connections = 0; var nodestream = io.listen(app).nodestream() .on('connect', function(){ connections++; this.emit('connections', connections); }) .on('disconnect', function(){ connections--; this.emit('connections', connections); }); :realtime(repaint: 'connections', local: 'connections') .connections - if (connections > 1) p #{connections} people are editing right now - else p You're all alone, loser
  • 23. Сообщество http://nodejs.ru/ http://groups.google.com/group/ru-nodejs/ http://groups.google.com/group/nodejs/
  • 24. http://nodejs.org/ http://howtonode.org/ http://antono.info/