Created
May 26, 2022 19:11
-
-
Save JonEast87/cc197155777a1c235c9edfeccb85eb54 to your computer and use it in GitHub Desktop.
Modern_asynchronous_programming_Async_and_await/src/main.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { welcome, goodbye, tell } = require("../utils/fortune-teller"); | |
async function getFortune(question) { | |
try { | |
const response = await tell(question) | |
console.log(`Your question was: ${question}`); | |
console.log(`Your fortune is: ${response}`); | |
} catch (err) { | |
console.log(`There was an error: ${err}`); | |
} | |
} | |
async function fullSession(question) { | |
try { | |
console.log(await welcome()) | |
await getFortune(question) | |
console.log(await goodbye()) | |
} catch (err) { | |
console.log(`There was an error: ${err}`); | |
} | |
} | |
module.exports = { getFortune, fullSession }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment