Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to Node.js

Naing Lin Aung
January 19, 2015
37

Introduction to Node.js

- Short Intro to Node.js
- Developer Conference 2014, Yangon

Naing Lin Aung

January 19, 2015
Tweet

Transcript

  1. What it is ? - based on Javascript V8 runtime

    - event driven - non-blocking standard libraries - Streams is supported in most APIs - support for C/C++ extension - package manager is included
  2. Blocking code Non-blocking code ေမာင္လွ  တံျမက္စည္းလွည္း၊  ေရခ်ိဳး  ၿပီးရင္  ထမင္းစားထားေခ်။ ေမာင္ျမသည္

     ေဆးေပါ့လိပ္ကုုိ  ပါးေစာင္တြင္ခဲကာ  ဖဲထုုိင္႐ုုိက္ေနသည္။  
  3. Real World Example var contents = fs.readFileSync('/etc/hosts'); console.log(contents); console.log('Doing something

    else'); ! fs.readFile('/etc/hosts', function(err, contents) { console.log(contents); }); console.log('Doing something else’);
  4. Differences ! - non-block code - single thread yet multiple

    pipeline - event driven - realtime ready Same - npm ( gem,composer,pip ) - modular structure - frameworks (express,sail,meteor,koa)
  5. - Javascript everywhere - can freely decide project structure -

    same with front-end code - reusable - familiar to us - can happily work with JSON style databases (MariaDB,MongoDB) Why ?? (Hooray!, rise of Javascript)
  6. Who use it ??? - LinkedIn,Yahoo! Microsoft Azure, Paypal -

    Strong and active community (Google) - Joyent start it, visionmedia contribute a lot and strongloop - approximately repo rate 4x increase in this year - There’s local node.js group (small but yet promising)
  7. What node isn’t - Frameworks like Laravel, Django and Rails

    - New Programming Language - Silver Bullet - Multi-threaded - For Beginners What node is - Web Socket Server - Fast File upload Client - Ad Server - Any Realtime data app
  8. Pitfall - Memory Management - hard to catch on -

    no significant difference or even slower in normal traffic - difficult to debug - strongly relies on benchmarking - not suit with normal crud applications - need to embrace whole new paradigm