I have a problem statement but I am unable to figure it out.
The problem is, I have 2 different Links lets say A and B. And I make an API called C.
API C includes A and B both Links in it. I want to create a functionality in API C that if I call API C first time it should only execute Link A and if I call it second time it should be Link B and third time Link A and forth time Link B .... like a round robin algorithm.
var link1 = "http://link1";
var link2 = "http://link2";
exports.newApi = asyncHandler(async (req, res, next) => {
//If i call first time it should execute link1,
var data = link1;
res.status().json({success: true, data});
//On second call it should execute link2
var data = link2;
res.status().json({success: true, data});
})