JavaScript Promises: There and back again
Broader adoption of JS on the server will only begin after ES6 generators land in Node. Due to the complexity of async code, writing JS on the server is not easy for the average team.<p>As of now, you could use Promises but it is still kind of messy without generators. Here is a simple example:<p><pre><code>  #Without generators
  Credentials.get({ token })
      .then (credentials) =>
          User.get({ username: credentials.username })

  #With generators
  credentials = yield Credentials.get({ token })
  User.get({ username: credentials.username })
</code></pre>
We use FaceBook's regenerator project to compile ES6 features down to Node's currently supported Javascript features. If you don't want to use the --harmony flag, you should really try it out. <a href="https://github.com/facebook/regenerator" rel="nofollow">https://github.com/facebook/regenerator</a>