Conquering Asynchronous Context with CLS

In synchronous code, handling your context is easy. If you want to grab your current user or request data, you usually just pull it out of the ether. In Node.js it’s not that simple. There’s no thread to hold your context, and no ether to be found. So when you want to do something like logging, how do you attach meta-data without passing it explicitly down your call chain?

In this talk I introduce Continuation-Local Storage and how it can solve this problem for you. Attach meta-data at the top of your call-chain and access it at the bottom. No more overloading the ‘req’ object & no more hijacking domains. It’s as simple as that.

Slidedeck Includes Annotations Additional slides have been added to the deck below to provide information originally only available in the talk itself.

Slides

Video



