NodeJS, why?

NodeJS, why?

An introductory presentation about Node.js platform that I presented on JusBrasil TED Talks. In this presentation I explain Node.js to beginners, show how it works and why it should be used. I also show who are using it and where it have been used besides web servers.

97381109baea93594baa2785dc0c99af?s=128

Rafael Verger

April 18, 2014
Tweet

Transcript

  1. why? @rafaelverger

  2. anyone? What problem Node.js tries to solve?

  3. I/O L . . .

  4. loading next slide ... I/O L . . .

  5. I/O Latency

  6. Web servers basic workflow

  7. How to solve it? THREEEEEEEEEEEEEEEEEADS :) THREEEEEEEEEEEEEEEEEADS :) THREEEEEEEEEEEEEEEEEADS :)

    THREEEEEEEEEEEEEEEEEADS :)
  8. How to solve it? THREADS...

  9. Threads or Subprocesses That's how we used to scale our

    apps 1. 2. idle busy
  10. How Node.js works Single process, Event Loop, Async I/O idle

    busy
  11. Node.js Event Loop

  12. How Node.js is built? libuv

  13. How Node.js code looks like? var http = require('http'); http.createServer(function

    (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World\n'); }).listen(1337, '127.0.0.1'); console.log('Server running at http://127.0.0.1:1337/');
  14. Bad stuff / Callback Hell :( @helielson

  15. Bad stuff / Callback Hell :(

  16. SOLVED \o/ Bad stuff / Callback Hell :(

  17. Since Node.js use only 1 single thread/process, in a single

    core, if a tasks takes too long to complete, the whole app will be stuck... Bad stuff / CPU Intensive tasks :( But don't worry.. it's very easy to spawn a child process and let him do the job :)
  18. Bad stuff / CPU Intensive tasks :( SOLVED spawning a

    child process \o/
  19. Bad stuff / Not a large community

  20. Bad stuff / Not a large community

  21. Bad stuff / Not a large community Now, in English:

  22. Goooood stuff :) - HUUUUGE Community! - Native and MANDATORY

    event driven programming - ES5 is all there - ES6 is almost done - Cross-platform (desktop, web, mobile, linux, windows, osx, one language to rule them all!! )
  23. Node.js Community

  24. Who builds Node.js ? We :D https://github.com/joyent/node Core committers (companies):

    Joyent, Strongloop, Chrome, Mozilla and Microsoft
  25. Who uses Node.js eBay LinkedIn Trello Yahoo Microsoft ...

  26. Node.js beyond web Tessel.io Nodebots Johnny Five Nodecopter

  27. Final review Event driven programming Async I/O Huge community One

    language to rule them all The best part of JavaScript Open source: https://github.com/joyent/node
  28. Questions? I know that you guys left shame at home

  29. Thanks! You're awesome! @rafaelveger

  30. References https://www.youtube.com/watch?v=L0pjVcIsU6A https://www.promisejs.org/ http://callbackhell.com/ http://nodejs.org/api/child_process.html#child_process_child_pid http://strongloop.com/strongblog/promises-in-node-js-with-q-an-alternative-to-callbacks/ http://misclassblog.com/interactive-web-development/node-js/