13
Quick Intro to Node.js

Quick Introduction to Node.js

Embed Size (px)

Citation preview

Page 1: Quick Introduction to Node.js

Quick Intro to Node.js

Page 2: Quick Introduction to Node.js

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

Page 3: Quick Introduction to Node.js

Blocking code

Non-blocking code

ေမာင္လွ  တံျမက္စည္းလွည္း၊  ေရခ်ိဳး  ၿပီးရင္  ထမင္းစားထားေခ်။

ေမာင္ျမသည္  ေဆးေပါ့လိပ္ကိုု  ပါးေစာင္တြင္ခဲကာ  ဖဲထိုုင္႐ိုုက္ေနသည္။  

Page 4: Quick Introduction to Node.js

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’);

Page 5: Quick Introduction to Node.js

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)

Page 6: Quick Introduction to Node.js

- 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)

Page 7: Quick Introduction to Node.js

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)

Page 8: Quick Introduction to Node.js

How ??

Page 9: Quick Introduction to Node.js

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

Page 10: Quick Introduction to Node.js

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

Page 11: Quick Introduction to Node.js

The next WebImagine

Page 12: Quick Introduction to Node.js

Furthermore

Learning sites (Codeschool,tutplus, and many so on) Node.js offical website Google Node.js videos on youtube !!

Page 13: Quick Introduction to Node.js

Contact

twitter : @kelvinm0rRis github : /nainglinaung linkedin : /in/nainglinaung