Im trying to integrate SailsJS with synchronize, which is based on fibers.
http://alexeypetrushin.github.io/synchronize/docs/index.html
As commented on other fiber libraries, I added a custom middleware to create a new fiber per the request.
var sync = require('synchronize');
...
...
sincronized: function (req, res, next) {
sync.fiber(next);
}
The middleware is executing I can confirm via a console. But then when I try to do anything fiber related, such as sync.defer() in one of my controllers, I do get an exception.
error: Error getting xxxxxx Error: no current Fiber, defer can't be used without Fiber!
As sailsjs is based in express, adding this middleware should be enough, although I have no idea what I might be missing.
As a side comment, if I create a fiber inside the controller method itself, everything works as expected.
Thanks.