rendering two pages

2

can i  render two pages when i process request from user in nodejs or any other …?
example:

app.get('/example',(req,res,next)=>(settimeout((=>(res.render('sample.ejs)),5000))res.render('anotherpage.ejs)))

Hadaa xoogahaa noo jilciso, waxaa laga yaabaa inaan kaaga jawaabno. Saan u jeedo middleware ayaa isticmaaleysaa, lakin xoogahaa noo sheeg wixii aad adiga horay u sameysay.

1
0

first of all, I looked at your code you have a timeout of 5 seconds to render sample.ejs the second one doesn’t have timeout render ask you self which one first you need to render and what is the second one you need to start render after first one and also don’t forget to use next() also give the other render timeout you also using get what are you doing? sometimes conditions may help you. what is the frontEnd is doing or sending to the backend?

app.get(‘/example’,(req,res,next)=>{
setTimeout(()=>{res.render(‘anotherpage.ejs’), res.render(‘sample.ejs’)}, 5000);
next()
})

June 14, 2021

i want to render anotherpage.ejs then after 5 sec i want to render sample.ejs because js will not wait timeout it will run the next code untill the timeout sat up

please check the code I have updated this is how u may need to write and also I have recorded a video you can see on YouTube also give the other page another timeout separated. or first do res.render(anotherpage.ejs) with out time out then write the next code with timeout there is many ways to achieve.
https://youtu.be/0sloqmWHCuo