Skip to content

Instantly share code, notes, and snippets.

@lionxcr
Last active February 4, 2022 04:29
Show Gist options
  • Save lionxcr/358887da4e4ef026d90ece0ab460064c to your computer and use it in GitHub Desktop.
Save lionxcr/358887da4e4ef026d90ece0ab460064c to your computer and use it in GitHub Desktop.
const dbConnection = new Promise((resolve, reject) => setTimeout(() => resolve(true), 500))
const myFunction = async (req, res) => {
try {
const result = await dbConnection();
// do something with result
} catch (e) {
console.error(e)
}
}
module.exports = async (req, res) => {
blah blah
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment