Monday, 15 May 2017

Node.js and mysql callbacks

I am new to node.js and callback-hell. I have to search in 4 different tables depending on user's search configurations. For example:

Table-1
    city
Table-2
    country
Table-3
    diet
Table-4 
    product

If I find any relevant information in any table, I need to return true and stop checking rest of the tables. If I cannot find relevant information in any table, I need to return false.

Do I need to write 4 callbacks (1 for each table)? Then how would I be able to skip rest of the callbacks if I find my relevant information in 1st table?

PS: due to "bad" database schema, a join query is not suitable.



via Momi

No comments:

Post a Comment