-
-
Notifications
You must be signed in to change notification settings - Fork 507
London_10-Saliha_Popal/Node-Module/quote-server #320
base: master
Are you sure you want to change the base?
Conversation
| (quote) => | ||
| quote.quote.toLowerCase().includes(term.toLowerCase()) || | ||
| quote.author.toLowerCase().includes(term.toLowerCase()) || | ||
| quote === "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you filitering empty quotes here?
server.js
Outdated
| app.get("/quotes/search", function (request, response) { | ||
| const term = request.query.term; | ||
| const searchResults = searchQuotes(term); | ||
| response.send({searchResults}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd recommend using .json when you're sending JSON data though, because it makes it obvious to other developers that you are aiming to send JSON data back.
Would be great if you study this => https://expressjs.com/en/api.html#res.send and see the difference between .send and .json
server.js
Outdated
| // ## Level 2 Challenge - allow quote _searches_! | ||
| function searchQuotes(term) { | ||
| const results = quotes.filter( | ||
| (quote) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you think of a situation where term is undefined? can you handle it by using response.status(400) and sending a message as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! seems you're learning Node well Saliha :) happy to discuss my comments further
Volunteers: Are you marking this coursework? You can find a guide on how to mark this coursework in
HOW_TO_MARK.mdin the root of this repositoryYour Details
Homework Details
Notes
What did you find easy?
What did you find hard?
What do you still not understand?
Any other notes?