From 9c6301b58c375916679bc573558275e8ef4b0cc5 Mon Sep 17 00:00:00 2001 From: Julie Nisbet Date: Thu, 22 Sep 2022 17:35:45 -0700 Subject: [PATCH] DO NOT MERGE - PR is for feedback purposes only --- feedback.md | 9 +++++++++ index.js | 53 ++++++++++++++++++++++++++++------------------------- 2 files changed, 37 insertions(+), 25 deletions(-) create mode 100644 feedback.md diff --git a/feedback.md b/feedback.md new file mode 100644 index 0000000..64f722d --- /dev/null +++ b/feedback.md @@ -0,0 +1,9 @@ +# Termagotchi + +I love this so much - its really just too cute. The ascii art is just :chefs-kiss:. I kind of want to use this as the deliverable for next module's terminal app lesson. Here's some general notes / feedback but overall, great job this week! + +- great job researching different terminal libraries +- really impressed with your work with promises in this app -- i know that was all new syntax for you so great job figuring it out during a project week +- Think about refactoring some functions from index.js into separate files just to keep the code a little shorter / cleaner +- You could think about completely removing the express server to be honest, and just connecting directly to your database -- I don't think you really need the API right now -- instead of funneling through the API, you could just call the Model methods directly in your utils +- Code is really clean & easy to read - nice work! \ No newline at end of file diff --git a/index.js b/index.js index befea70..ee07337 100755 --- a/index.js +++ b/index.js @@ -44,7 +44,10 @@ const { suitcase, } = require('./lib/utils/ascii'); -const sleep = (ms = 5000) => new Promise((r) => setTimeout(r, ms)); +// hope this makes more sense now that you've done a deliverable on promises! +// i generally like to use res as my variable name in promises to make it +// clear its the resovle function +const sleep = (ms = 5000) => new Promise((res) => setTimeout(res, ms)); const asciiMap = { 2: gradient.summer(forest), @@ -127,31 +130,31 @@ const setUser = async () => { return signUp(); } }); +}; - const signIn = async () => { - inquirer - .prompt([ - { - prefix: '*', - name: 'username', - message: 'Enter your Termagotchi name:', - }, - { - prefix: '*', - name: 'password', - type: 'password', - message: 'Enter your password', - }, - ]) - .then((answers) => { - console.log(chalk.bold(`Welcome back to ${answers.username}!`)); - console.log(gradient.retro(excited)); - return signInUser(answers.username, answers.password); - }) - .then(() => { - return storyLine(1); - }); - }; +const signIn = async () => { + inquirer + .prompt([ + { + prefix: '*', + name: 'username', + message: 'Enter your Termagotchi name:', + }, + { + prefix: '*', + name: 'password', + type: 'password', + message: 'Enter your password', + }, + ]) + .then((answers) => { + console.log(chalk.bold(`Welcome back to ${answers.username}!`)); + console.log(gradient.retro(excited)); + return signInUser(answers.username, answers.password); + }) + .then(() => { + return storyLine(1); + }); }; const signUp = async () => {