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

How to achive dynamic scoping in Node.js

Avatar for Dmytrii S. Dmytrii S.
November 27, 2014

How to achive dynamic scoping in Node.js

How to achive dynamic scoping in javascript on server side and start handling requests in the same manner, as we did in PHP. Even further, using dynamic scoping you can have a reference to the actual HTTP request instance you currently handling, without any tedious passing of params, the same way we do on client side – we simply have our page in global context. You can even have per-request caching, by simply creating a variable in a dynamic scope of a HTTP request.

And there plenty of different applications of dynamic scoping in Node.js, like more robust isomorphic frameworks like Meteor, but without any performance hit and Node.js on server side!

Avatar for Dmytrii S.

Dmytrii S.

November 27, 2014
Tweet

More Decks by Dmytrii S.

Other Decks in Technology

Transcript

  1. N JS O D E . revolution with a dynamic

    scopE Dmytrii Shchadei @Metrofun
  2. “this” is a keyword, not a variable Javascript has a

    lexical scoping Javascript SCOPE gotchas
  3. CAVEATS ** Domains have performance hit ( only ~5% rps

    reduce ) * Some libraries doesn’t support domains ( use domain.bind )