The below is my code.I want to increase the page no. whenever there are more than 9 entries i.e a single page should contain only 9 entries.
var pageNo = 1;
if(tempDetail.length/9 >= 0)
pageNo++;
res.status(200).json(
{
totalTemplatesinDb:tempDetail.length,
pages:pageNo,
totalTemplates: ((BTtemplata.length) + (Shtemplata.length) + (FNtemplata.length)),
groupName: [{ "name": "Telecom", totalTemplate: BTtemplata.length, template: BTtemplata }, { "name": "Retail", totalTemplate: Shtemplata.length, template: Shtemplata },{"name": "Finance", totalTemplate: FNtemplata.length, template: FNtemplata}],
});
}
catch (error) {
console.log(error);
res.status(500).json({
error: err
});
}
};