app.get('/god', (req, res) => {
let year = 2533;
let preyearlist = [];
let preyearsuperlist = [];
let yearlist = [];
let nextyear = new Date().getFullYear()+543;
let channel = [];
while(year <= nextyear){
channel = []
for (let i=0; i < 10; i++) {
preyearsuperlist = [];
preyearlist = [];
let peryear = [];
let ayear = year+i
fetch('https://www.myhora.com/%E0%B8%AB%E0%B8%A7%E0%B8%A2/%E0%B8%9B%E0%B8%B5-'+ayear+'.aspx')
.then(res => res.text())
.then((body) => {
let $ = cheerio.load(body);
})
}
year += 10
}
res.send(yearlist)
})
while loop end before get all html code from fetch
i don't know how to wait html code from fetch and load into cheerio
i try with setTimeout but is not working