-
-
Notifications
You must be signed in to change notification settings - Fork 76
NW6 | Sabella Fisseha | Server Module | Mailing list #174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Ara225
left a comment
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.
No major complaints, well done
| const data = require("./mailing-lists"); | ||
| const app = express(); | ||
| app.use(express.json()); | ||
| const lists = new Map(Object.entries(data)); |
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.
Is there any particluar reason you wanted to copy the data into a diffrent object?
| if (listsArray.length > 0) { | ||
| res.status(200).send(listsArray); | ||
| } else { | ||
| res.status(200).send({}); |
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.
This is not correct I'm afraid - the readme asked for an empty array not an empty object
| } else { | ||
| res.status(404).send("list not found"); | ||
| } | ||
| }); |
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.
👍
| const updatedList = Array.from(lists.keys()); | ||
| res.status(200).send(updatedList); | ||
| } else { | ||
| res.status(404).send("list not found"); |
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.
Good work - apprecate the good error checking you have here :)
| const updatedList = Array.from(lists.keys()); | ||
| res.status(201).send(updatedList); | ||
| } | ||
| }); |
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.
Good work :)


Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
Questions
Ask any questions you have for your reviewer.