Skip to content

Instantly share code, notes, and snippets.

@ozjimbob
Last active February 28, 2025 09:46
Show Gist options
  • Save ozjimbob/5836eeae0a2c50524266600031009be3 to your computer and use it in GitHub Desktop.
Save ozjimbob/5836eeae0a2c50524266600031009be3 to your computer and use it in GitHub Desktop.
/* GET home page which lists blog posts. */
router.get('/', (req, res, next) => {
console.log("Waiting")
// With awaits - crash, not allowed
// Without awaits - functions are called, but I never get my data back because it doesn't wait for the answer before proceeding...
const [data,links]= await Promise.all([
await postsfn(),
await linksfn()
])
console.log(data);
console.log(links);
res.render('index', {data:data,sitename:config.sitename, links:links});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment