jeudi 26 mars 2020

Is this an async / sync issue in my NodeJS Express app?

My server hangs for a long time before it processes the next request when function1() is included in the if statement. Both function1() and function2() return booleans. If I include function2() twice its fine. If I replace function1() with 1 its fine.

This tells me its an issue with function1() but the function just returns a boolen. I can't figure out whats wrong.

router.post('/something', function(req, res){

    if(function1() && function2()){
        some processing...
        res.json(data);
    }
    else{
        res.json{differentData};
    }
}

var function1() = function(string){
    return true;
}

Aucun commentaire:

Enregistrer un commentaire