Skip to content
This repository was archived by the owner on Oct 2, 2024. It is now read-only.

London-10-shadi-fakhri-node-week-1 - #329

Open
Shadi38 wants to merge 2 commits into
CodeYourFuture:masterfrom
Shadi38:master
Open

London-10-shadi-fakhri-node-week-1#329
Shadi38 wants to merge 2 commits into
CodeYourFuture:masterfrom
Shadi38:master

Conversation

@Shadi38

Copy link
Copy Markdown

Volunteers: Are you marking this coursework?You can find a guide on how to mark this coursework in HOW_TO_MARK.md in the root of this repository

Your Details

  • Your Name:
  • Your City:
  • Your Slack Name:

Homework Details

  • Module:
  • Week:

Notes

  • What did you find easy?

  • What did you find hard?

  • What do you still not understand?

  • Any other notes?

@ShayanMahnamShayanMahnam left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done, Shadi!
First, thank you for putting the "node_modules" in the gitignore file. You did everything correctly. I will now add some error handling for you, which will be useful in the future.

Comment threadserver.js

//...END OF YOUR CODE
// /quotes - Should return all quotes (json)
app.get("/quotes", (req, res) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

app.get("/quotes",(req,res)=>{if(quotes.length===0){returnres.status(404).json({error: "No quotes found."});}res.send({ quotes });});

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, Shayan. you mentioned a good point. From now I will use it in my projects.

Comment threadserver.js
app.get("/quotes", (req, res) => {
res.send({quotes});
});
// /quotes/random - Should return ONE quote (json)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

app.get("/quotes/random",(req,res)=>{if(quotes.length===0){returnres.status(404).json({error: "No quotes found."});}constrandomQuote=pickFromArray(quotes);res.send(randomQuote);});

Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@Shadi38@ShayanMahnam