lundi 9 mars 2015

Nodejs application hangs after page refresh

What would be the cause for having a request done and after refreshing page(aka making a new request) page hang(is loading forever) ? How can I debug this thing ?


My code looks something like:



if(params are not good){
res.status(500).json("Invalid date.");
}else{
doDatabaseQuery(callback);
callback.onSuccess(data) => res.status(200).json(data);
callback.onError(err) => res.status(500).json(err);
}


If I change code and instead of res.status(200).json(data) I have return res.status(200)... I get: Can\'t set headers after they are sent. after more than 1 request.


Aucun commentaire:

Enregistrer un commentaire