Slide 1

Slide 1 text

Hello Node @salimkayabasi +SalimKAYABAŞI

Slide 2

Slide 2 text

[email protected] nodejstr.com gdgistanbul.com salimkayabasi.com github.com/salimkayabasi @salimkayabasi +SalimKAYABAŞI

Slide 3

Slide 3 text

• Google V8 • Server-side Javascript • One single thread • Event loop • Non-blocking IO • NPM

Slide 4

Slide 4 text

• https://github.com/joyent/node/wiki/Projects,- Applications,-and-Companies-Using-Node

Slide 5

Slide 5 text

• Chrome uses V8 as JS Engine • Ready for Windows/Linux/Mac • %40 JS and %60 C/C++ • Node isn’t a programming lang, this is FW • NPM is node package manger • Live on Github • Nodepad++ or Sublime is enough Basics of Nodejs

Slide 6

Slide 6 text

• Async programming • Callback Hell!!! Deeply nested callbacks • Understanding Closures • Using loops that contains callback • Dependent callbacks Downsides

Slide 7

Slide 7 text

var c = 0 doThis(someinputs,function(error,result){ c++ if(c === 3) doAgain(someinputs) }) doThat(someinputs,function(error,result){ c++ if(c === 3) doAgain(someinputs) }) doNone(someinputs,function(error,result){ c++ if(c === 3) doAgain(someinputs) }) doThis(someinputs,function(error,result){ var value = result.value //do anything doMore(value,function(error,result){ var moreValue = result.value }) }) callback examples

Slide 8

Slide 8 text

var c = 0 doThis(someinputs,function(error,result){ c++ if(c === 3) doAgain(someinputs) }) doThat(someinputs,function(error,result){ c++ if(c === 3) doAgain(someinputs) }) doNone(someinputs,function(error,result){ c++ if(c === 3) doAgain(someinputs) }) doThis(someinputs,function(error,result){ var value = result.value //do anything doMore(value,function(error,result){ var moreValue = result.value }) }) Traditional IO Non-traditional IO non-blocking io

Slide 9

Slide 9 text

http server tcp server 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/'); var net = require('net'); var server = net.createServer(function (socket) { socket.write('Echo server\r\n'); socket.pipe(socket); }); server.listen(1337, '127.0.0.1'); node server.js

Slide 10

Slide 10 text

• JS: Definitive Guide • JS: The Good Oarts Learning JS Do not try to learn everything, because this is imposible. Learn js as you need :)

Slide 11

Slide 11 text

• Auto balance on core/cpu • Designed for scalability • Multi-core server scaling “LearnBoost/cluster” • Minimal cost in cloud usage • Joyent, Amazon, Microsoft Azure, IBM support • Speed development with less effor Cloud Computing

Slide 12

Slide 12 text

express socket.io jade redis uglify-js momentjs mongoose passport gzippo i18n request node-mysql azure aws- sdk msnodesql npm install -g

Slide 13

Slide 13 text

Q&A

Slide 14

Slide 14 text

Thanks