Open GA-DAVID opened 1 year ago
Hey David,
Thanks for the feedback. I’m assuming the approved means this is still a passing homework assignment, correct?
Thanks,
Matt
On Mon, Mar 20, 2023 at 2:45 PM GA-DAVID @.***> wrote:
Hey Matt, great work with this lab, here are my implementations below, compare to yours, let me know if you have any questions!
app.get("/magic/:question", (req, res) => { const answers = [ "It is certain", "It is decidedly so", "Without a doubt", "Yes definitely", "You may rely on it", "As I see it yes", "Most likely", "Outlook good", "Yes", "Signs point to yes", "Reply hazy try again", "Ask again later", "Better not tell you now", "Cannot predict now", "Concentrate and ask again", "Don't count on it", "My reply is no", "My sources say no", "Outlook not so good", "Very doubtful", ]; const randomIndex = Math.floor(Math.random() * answers.length); log(randomIndex);
const { question } = req.params; log(question); log(encodeURIComponent(question)); //converts any string into URL friendly format res.send(
${answers[randomIndex]}
); });app.get("/tip/:bill/:tipPercent", (req, res) => { const { bill, tipPercent } = req.params; log(Your bill is ${bill} and your tip percent is ${tipPercent}); res.status(200).json((tipPercent / bill) * 100); });
//--------------------------------------------------------------- app.get("/:bottles", (req, res) => { const { bottles } = req.params; const link = bottles <= 0 ? 99 : bottles - 1;
res.send(
${bottles} Bottles of Beer of the wall take one down, pass it around
); });— Reply to this email directly, view it on GitHub https://github.com/flat1ander/express-lab-2/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/A44VFIW7RYJ6XXG7KFBWPY3W5CQS3ANCNFSM6AAAAAAWBPFTDE . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Correct, you pass my friend!
On Mon, Mar 20, 2023, 12:18 PM flat1ander @.***> wrote:
Hey David,
Thanks for the feedback. I’m assuming the approved means this is still a passing homework assignment, correct?
Thanks,
Matt
On Mon, Mar 20, 2023 at 2:45 PM GA-DAVID @.***> wrote:
Hey Matt, great work with this lab, here are my implementations below, compare to yours, let me know if you have any questions!
app.get("/magic/:question", (req, res) => { const answers = [ "It is certain", "It is decidedly so", "Without a doubt", "Yes definitely", "You may rely on it", "As I see it yes", "Most likely", "Outlook good", "Yes", "Signs point to yes", "Reply hazy try again", "Ask again later", "Better not tell you now", "Cannot predict now", "Concentrate and ask again", "Don't count on it", "My reply is no", "My sources say no", "Outlook not so good", "Very doubtful", ]; const randomIndex = Math.floor(Math.random() * answers.length); log(randomIndex);
const { question } = req.params; log(question); log(encodeURIComponent(question)); //converts any string into URL friendly format res.send(
${answers[randomIndex]}
); });app.get("/tip/:bill/:tipPercent", (req, res) => { const { bill, tipPercent } = req.params; log(Your bill is ${bill} and your tip percent is ${tipPercent}); res.status(200).json((tipPercent / bill) * 100); });
//--------------------------------------------------------------- app.get("/:bottles", (req, res) => { const { bottles } = req.params; const link = bottles <= 0 ? 99 : bottles - 1;
res.send(
${bottles} Bottles of Beer of the wall take one down, pass it around
); });— Reply to this email directly, view it on GitHub https://github.com/flat1ander/express-lab-2/issues/1 https://urldefense.com/v3/__https://github.com/flat1ander/express-lab-2/issues/1*3E__;JQ!!GgcXpDZ2N9l6uyZJ!nbeBR1KUKithBLzklLUpc0C10AAgFq2CoQu10h0mzz5naxGz0TXYaFYb3L1hGI-lt2mrfrsuSCs4gFfW-R3c5FHp_JSop7YfuQ$, or unsubscribe < https://github.com/notifications/unsubscribe-auth/A44VFIW7RYJ6XXG7KFBWPY3W5CQS3ANCNFSM6AAAAAAWBPFTDE> https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/A44VFIW7RYJ6XXG7KFBWPY3W5CQS3ANCNFSM6AAAAAAWBPFTDE*3E__;JQ!!GgcXpDZ2N9l6uyZJ!nbeBR1KUKithBLzklLUpc0C10AAgFq2CoQu10h0mzz5naxGz0TXYaFYb3L1hGI-lt2mrfrsuSCs4gFfW-R3c5FHp_JRJ_VK22Q$ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
— Reply to this email directly, view it on GitHub https://urldefense.com/v3/__https://github.com/flat1ander/express-lab-2/issues/1*issuecomment-1476804483__;Iw!!GgcXpDZ2N9l6uyZJ!nbeBR1KUKithBLzklLUpc0C10AAgFq2CoQu10h0mzz5naxGz0TXYaFYb3L1hGI-lt2mrfrsuSCs4gFfW-R3c5FHp_JRO9AcqAQ$, or unsubscribe https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/A5NOJTBYBES3ZINYHPXIY2DW5CUQTANCNFSM6AAAAAAWBPFTDE__;!!GgcXpDZ2N9l6uyZJ!nbeBR1KUKithBLzklLUpc0C10AAgFq2CoQu10h0mzz5naxGz0TXYaFYb3L1hGI-lt2mrfrsuSCs4gFfW-R3c5FHp_JQqGih4Ew$ . You are receiving this because you authored the thread.Message ID: @.***>
Hey Matt, great work with this lab, here are my implementations below, compare to yours, let me know if you have any questions!
app.get("/magic/:question", (req, res) => { const answers = [ "It is certain", "It is decidedly so", "Without a doubt", "Yes definitely", "You may rely on it", "As I see it yes", "Most likely", "Outlook good", "Yes", "Signs point to yes", "Reply hazy try again", "Ask again later", "Better not tell you now", "Cannot predict now", "Concentrate and ask again", "Don't count on it", "My reply is no", "My sources say no", "Outlook not so good", "Very doubtful", ]; const randomIndex = Math.floor(Math.random() * answers.length); log(randomIndex);
const { question } = req.params; log(question); log(encodeURIComponent(question)); //converts any string into URL friendly format res.send(
<h1>${answers[randomIndex]}</h1>
); });app.get("/tip/:bill/:tipPercent", (req, res) => { const { bill, tipPercent } = req.params; log(
Your bill is ${bill} and your tip percent is ${tipPercent}
); res.status(200).json((tipPercent / bill) * 100); });//--------------------------------------------------------------- app.get("/:bottles", (req, res) => { const { bottles } = req.params; const link = bottles <= 0 ? 99 : bottles - 1;
res.send(`
${bottles} Bottles of Beer of the wall
take one down, pass it around `); });