Friday 15 January 2016

Waiting for a query to return?

I'm working on my first project with node.js and Jade. I have a router.post target that does some parsing of input, then does a MySQL query, then based on the result of that it might do a HTTP request and some parsing of the page content, and finally depending on the results of all of those it should decide what page to forward to.However, it looks like what's happening is that it starts the database query but doesn't wait for a response before continuing, so even if the DB/HTTP work would cause it to go to a page other than the default, it goes to the default and then completes the DB/HTTP work. I can see in my console logs something like:begin text parsing redirect to default GET /finalpage begin db query db data received begin http request http data received http data parse result What can I do to make the processing run serially, or is there some other way I should be architecting this?

Submitted January 15, 2016 at 10:33AM by mwilykat

No comments:

Post a Comment