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

Effective Node.js : Øredev 2013

jedwood
November 07, 2013

Effective Node.js : Øredev 2013

jedwood

November 07, 2013
Tweet

More Decks by jedwood

Other Decks in Technology

Transcript

  1. Effective Agenda My Favorite Modules Promises (briefly!) Scraping & Proxies

    Node for non-Node Hosting ! Not Covered History of Node.js Http ‘Hello World’ example Whining about callback hell Whining about Javascript !
  2. Effective Agenda Not Covered History of Node.js Http ‘Hello World’

    example Whining about callback hell Whining about Javascript Whining about other languages that can do all this stuff that Node.js nerds think is so cool My Favorite Modules Promises Scraping & Proxies Node for non-Node Hosting !
  3. On the server side, our entire mobile so!ware stack is

    completely built in Node. One reason was scale. The second is Node showed us huge performance gains. Kiran Prasad Director of Engineering, Mobile
  4. The point of promises is to give us back functional

    composition and error bubbling in the async world. ! The thing is, promises are not about callback aggregation. That's a simple utility… Promises
  5. …More importantly, if at any point that process fails, one

    function in the composition chain can throw an exception, which then bypasses all further compositional layers until it comes into the hands of someone who can handle it with a catch. Domenic Denicola “You're Missing the Point of Promises” Promises
  6. Future-proof your own modules - sync functions should accept callbacks

    ! - better yet, allow for callbacks or promises
  7. Express-Resource (-new) articles: index GET /articles.:format? new GET /articles/new.:format? create

    POST /articles.:format? show GET /articles/:article.:format? edit GET /articles/:article/edit.:format? update PUT /articles/:article.:format? destroy DELETE /articles/:article.:format? ! article_comments: index GET /articles/:article/comments.:format? new GET /articles/:article/comments/new.:format? … etc github.com/tpeden/express-resource-new
  8. pro tips: ! - defaults to global cookie storage; not

    good for multiple users! - maxSockets defaults to 5 (Node.js in general) github.com/mikeal/request
  9. Hosting Node.js on your own - bouncy - forever -

    consider multiple cores / clustering
  10. Mongoose: Fat Models - ‘pre’ hooks - schema statics -

    instance methods - virtuals - populate