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

Hello Node

Hello Node

This presentation has lots of words for beginner of NodeJS development.

Last time that I use this present was at GDG DevFest Istanbul 2013

It contains,

* Basics of Node
* What about cloud computing
* Some keywords that you need to google them

Salim KAYABAŞI

November 06, 2013
Tweet

More Decks by Salim KAYABAŞI

Other Decks in Programming

Transcript

  1. • Google V8 • Server-side Javascript • One single thread

    • Event loop • Non-blocking IO • NPM
  2. • 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
  3. • Async programming • Callback Hell!!! Deeply nested callbacks •

    Understanding Closures • Using loops that contains callback • Dependent callbacks Downsides
  4. 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
  5. 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
  6. 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
  7. • JS: Definitive Guide • JS: The Good Oarts Learning

    JS Do not try to learn everything, because this is imposible. Learn js as you need :)
  8. • 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
  9. express socket.io jade redis uglify-js momentjs mongoose passport gzippo i18n

    request node-mysql azure aws- sdk msnodesql npm install -g
  10. Q&A