S
S
shcoderAlex2013-09-09 09:49:33
JavaScript
shcoderAlex, 2013-09-09 09:49:33

[nodejs] fibrous conflict with madhums(express) demo

Good afternoon.

Recently, I have been developing using nodejs, completely green ...

Recently I came across a good fibrous module that allows you to write synchronous code, but an attempt to attach it to the project was unsuccessful. The project is based on the demo madhums " node-express-mongoose-demo "
I googled, didn't really find anything that could help... That's
why I decided to turn to a more experienced Habr community for help.

For the test, I repeated my mistake on a clean demo and poured it into the git

I connected fibrous in config / express - lines 11 and 49.
Created a demo controller and assigned routing from the root to it.

The mistake itself
Error: Can't wait without a fiber
    at Function.wait (/home/user/www/project/node_modules/fibrous/node_modules/fibers/future.js:83:9)
    at Object.Future.wait (/home/user/www/project/node_modules/fibrous/node_modules/fibers/future.js:325:10)
    at Object.<anonymous> (/home/user/www/project/node_modules/fibrous/lib/fibrous.js:62:47)
    at Object.readFile (/home/user/www/project/node_modules/fibrous/lib/fibrous.js:97:47)
    at exports.fab (/home/user/www/project/app/controllers/demo.js:15:17)
    at callbacks (/home/user/www/project/node_modules/express/lib/router/index.js:161:37)
    at param (/home/user/www/project/node_modules/express/lib/router/index.js:135:11)
    at pass (/home/user/www/project/node_modules/express/lib/router/index.js:142:5)
    at Router._dispatch (/home/user/www/project/node_modules/express/lib/router/index.js:170:5)
    at Object.router (/home/user/www/project/node_modules/express/lib/router/index.js:33:10)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
T
Timur Shemsedinov, 2013-09-09
@MarcusAurelius

Interesting library, worth exploring. Unfortunately, I don't use express, and can't answer in a qualified manner, but people have had a similar problem github.com/goodeggs/fibrous/issues/10 Obviously express (or its data access plugins) corrupts the data structures that fibrous creates when bound to method calls. Methods are hung up in the fibrous queue, and when the time comes to execute them and return control to the right place, it turns out that there is no data. For good, of course, fibrous should not attach data to objects that he does not create, but should make internal data structures and indexes for called methods. Well, you need to study and rewrite the library.

P
pomeo, 2013-09-09
@pomeo

Try it first on a bare express, there is too much stuff in the demo and because of what the error occurs it is difficult to trace.

B
bsdemon, 2013-09-15
@bsdemon

Add fibrous.middlewarean application to Express. You can't use fibrousmethods unless you're in Fiber, so this one middlewarewraps the express code in Fiber.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question