node.js - NodeJs program flow -


currently still understanding logic flow of typical web application. in php, since not async, typically have wait database insert/update completed before returning response user.

but since in nodejs can have async database query callback , return response user before callback being called database.

in these kind of situation, assuming validation of data done, typical nodejs application wait callback before response or assume query successful , return response user?

i'm not entirely sure you're asking should take @ these explanations of async database queries:

if interpreted question correctly asking when node application return response, right? typically return response user (like updating client view) within callback. providing callback can make sure response received , successful before moving on in thread. here bit of code illustrate:

functionthattakesforever(argument, function(error, response){ //this callback     if(error)         console.log(error);     else{         \\do response return response user     } }); 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -