Thursday 25 January 2018

A little help with looping over MySQL rows in node

I’m new to the node world and trying to write an api with node, express & MySQL. The problem I am having is when looping through a group of results and then running another select based on the id of the current row in the loop and adding the 2nd selects records to the current object in the loop. I think the issue may be that I am using standard js looping instead of async or a promise based approach and I end up sending the result back before all the queries have run. Can anyone advise on the best approach as there seem to be so many methods available, which is best and future proof??

Submitted January 25, 2018 at 07:22PM by Finrojo

No comments:

Post a Comment