London | 25-SDC-July | Eyuel Abraham | Sprint 3 | Middleware exercises#37
London | 25-SDC-July | Eyuel Abraham | Sprint 3 | Middleware exercises#37eyuell21 wants to merge 5 commits intoCodeYourFuture:mainfrom
Conversation
|
Your PR description contained template fields which weren't filled in. Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed. If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
LonMcGregor
left a comment
There was a problem hiding this comment.
Looking good, though I have a suggestion of something to think about to help practise writing even more reusable middleware
| const parsed = JSON.parse(data); | ||
| if ( | ||
| !Array.isArray(parsed) || | ||
| !parsed.every(item => typeof item === 'string') |
There was a problem hiding this comment.
What is the goal of this middleware - it seems to do two things.
Here you're combining JSON parsing and checking the input is strings. As middleware aims to allow re-use of code, what change could you make to this that would allow you to re-use these separate checks more easily?
There was a problem hiding this comment.
Thanks, I've made some changes according to the review.
…ove code readability
LonMcGregor
left a comment
There was a problem hiding this comment.
good change, when you can make functionality reusable, it's always good to take advantage of this
Learners, PR Template
Self checklist
Changelist
Middleware implementations.
Questions
No questions.