I have two API both Get type first one returns 25000 records and the second one return a single document. When I hit the first API using the browser for 25000 records and at the same time I hit the second API on a new tab so the second API is waiting for the first to finish after that second is executed. I want both API can run parallelly
Code
My first API -
exports.testApi = async(req,res) => {
var data = await Task.find({}).limit(25000).exec();
return res.status(200).send({success:true,message:'Record fetch Successfully',data:data}).end();
}
Second API
exports.testApi2 = async(req,res) => {
var data = await Timesheet.findOne({}).exec();
return res.status(200).send({success:true,message:'Record fetch Successfully',data:data}).end();
}