Getting the empty response when the node api hitting first time even though the data is available in couchbase, When hitting the second time it works fine.
This is my api for getting the data:
app.get('/api/store/findByAccNo/:accountNumber',function(req,res) {
storeMdl.findByAccountNumber(req.params.accountNumber,function(err,data){
if (data=="") {
var message = JSON.parse('{"status":"Failed","message":"Store does not exist"}');
res.send(200, message);
} else{
var message = JSON.parse('{"status":"Success","message":' + JSON.stringify(data) + '}');
res.send(message)
}
});
});
If I am doing any thing wrong please help me to solve this.
Thanks