M
M
musuk2014-07-30 15:00:13
JavaScript
musuk, 2014-07-30 15:00:13

What is Flowy alternative for node.js?

I am using Flowy for flow control in Node.js. Flowy allows you to write readable chain code like this:

Flowy.chain(function(){
  _trips.findOne({id:tripId}, this.slot());
  _users.findOne({id:userId}, this.slot());
})
.then(function(err, trip, user){
  ...
})
.fail(function(err){
  ...
})

Flowy hasn't been updated in a while, are there any modern alternatives to Flowy to write readable asynchronous JS?
Article about Flowy habrahabr.ru/post/166419

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Konstantin Kitmanov, 2014-07-30
@musuk

async ?

A
Alexey Yaroshevich, 2014-08-01
@qfox

Right off the bat, this is Q , and Vow (I use it most often, including on the client).
There are also lesser-known then promises and bluebirds.
All this is called Promises (promises) or Promises / A +
This is what promises are about. There are other libraries bit.ly/1putPFj
There is another option for using various libraries for flow control, which also make more or less harmonious code out of mountain noodles.
Incl. async , a simpler but equally efficient wrapper around standard callbacks.
And others: Step , Seq , FuturesJS .
In addition, the standard will sooner or later include the so-called. generators (yield) are part of harmony es6 . There are even developments in this direction such as koajs (a replacement for expressjs ).
They are in the 0.11 branch, but require a flag to run. Of course, there are no guarantees that this will appear in 0.12, but in 0.14 or 0.16 it will appear with a high degree of probability.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question