Slide 1

Slide 1 text

Why Node.js? #webkonf Gergely Nemeth @nthgergo

Slide 2

Slide 2 text

WHOAMI nodebp.com oneshot.risingstack.com risingstack.com

Slide 3

Slide 3 text

JAVASCRIPT - created in 1995 - runs in every major browser - prototype-based, dynamic typing, first- class functions

Slide 4

Slide 4 text

JAVASCRIPT

Slide 5

Slide 5 text

JAVASCRIPT not just the language of the browser any more

Slide 6

Slide 6 text

FIRST-CLASS CITIZEN IN OSX

Slide 7

Slide 7 text

INTERNET OF THINGS

Slide 8

Slide 8 text

IN THE CLOUD

Slide 9

Slide 9 text

NODE.JS “for easily building fast, scalable network applications”

Slide 10

Slide 10 text

NODE.JS - V8

Slide 11

Slide 11 text

NODE.JS - V8 - nonblocking I/O

Slide 12

Slide 12 text

NODE.JS Blocking I/O the traditional way Nonblocking I/O the Node.js way

Slide 13

Slide 13 text

NODE.JS - V8 - nonblocking I/O - event driven

Slide 14

Slide 14 text

NODE.JS - V8 - nonblocking I/O - event driven - single threaded

Slide 15

Slide 15 text

CALLBACKS fs.readFile('/file', function(err, data) { if (err) throw err; console.log(data); });

Slide 16

Slide 16 text

SOME OF THE ADOPTERS…

Slide 17

Slide 17 text

THE PAYPAL CASE-STUDY existing Java stack

Slide 18

Slide 18 text

THE PAYPAL CASE-STUDY Java and Node in parallel

Slide 19

Slide 19 text

THE PAYPAL CASE-STUDY One Language to Rule them all

Slide 20

Slide 20 text

THE PAYPAL CASE-STUDY Now all new apps at PayPal are written in Node.

Slide 21

Slide 21 text

THE PAYPAL CASE-STUDY - Headcount: from ⅓ to 1/10 - Performance: 10x throughput in scale - Lines of code: code size shrink by factor of 3-5

Slide 22

Slide 22 text

HOW?

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

NPM - open repository for Node modules - proper SemVer - more than 100.000 modules - open source all the things!

Slide 25

Slide 25 text

NPM Would be nice to use all this in the browser as well?

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

BROWSERIFY - require('modules') in the browser - bundling up all of your dependencies from the node_modules dir - does not pollute the global scope http://blog.risingstack.com/publishing-your-first-browserify-node-module/

Slide 28

Slide 28 text

BROWSERIFY // main.js var $ = require('jquery'); $('body').append('

Hello Browserify!

'); npm install jquery --save browserify main.js -o bundle.js

Slide 29

Slide 29 text

Which brings us to...

Slide 30

Slide 30 text

ISOMORPHIC JAVASCRIPT http://blog.risingstack.com/from-angularjs-to-react-the-isomorphic-way/

Slide 31

Slide 31 text

Thanks! Gergely Nemeth @nthgergo