Quick Introduction to Node.js
-
Upload
naing-lin-aung -
Category
Technology
-
view
362 -
download
1
Transcript of Quick Introduction to Node.js
Quick Intro 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
Blocking code
Non-blocking code
ေမာင္လွ တံျမက္စည္းလွည္း၊ ေရခ်ိဳး ၿပီးရင္ ထမင္းစားထားေခ်။
ေမာင္ျမသည္ ေဆးေပါ့လိပ္ကိုု ပါးေစာင္တြင္ခဲကာ ဖဲထိုုင္႐ိုုက္ေနသည္။
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’);
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)
- 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)
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)
How ??
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
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
The next WebImagine
Furthermore
Learning sites (Codeschool,tutplus, and many so on) Node.js offical website Google Node.js videos on youtube !!
Contact
twitter : @kelvinm0rRis github : /nainglinaung linkedin : /in/nainglinaung