-
-
Notifications
You must be signed in to change notification settings - Fork 76
NW6 | Rabia Avci | Module Servers | [TECH ED] Mailing list API Project | Week 4 #177
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?
NW6 | Rabia Avci | Module Servers | [TECH ED] Mailing list API Project | Week 4 #177
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.
Good work :)
|
|
||
| const app = express(); | ||
| app.use(express.json()); | ||
| app.disable("x-powered-by"); |
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 particulaur reason for this line of code? It's a good question to ask yourself whenever you find anything odd in code.
| app.use(express.json()); | ||
| app.disable("x-powered-by"); | ||
|
|
||
| const mailList = mailinglist; |
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.
Another line that doesn't make too much sense to me - is there any particuluar reason that the var needs reassigned?
| app.get("/lists", (req, res) => { | ||
| const listsArray = Object.keys(mailList); | ||
| res.status(200).json(listsArray); | ||
| }); |
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, appreciate the comments - makes it easier to skim read
| } else { | ||
| res.status(404).json({ error: "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.
👍
| } else { | ||
| res.status(404).json({ message: "Name not found for delete" }); | ||
| } | ||
| }); |
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.
👍
| mailList[name] = members; | ||
| res.status(201).json({ message: "New list created successfully." }); | ||
| } | ||
| }); |
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.
Amazing, nice to see you've done the stretch goal as well!




Learners, PR Template
Self checklist
Changelist
Created a Mailing List REST API.
Routes
/lists - fetch all the existing list names
/lists/:name - get list by name, delete by name, add or update a list with the given name // adjusted with different status codes such as 200,201,404
Stretch 1 is done: checks if the path matches the name in JSON.