Thanks to visit codestin.com
Credit goes to github.com

Skip to content

week2-homework #14

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

FaziletKosure
Copy link

No description provided.

@dfdeagle47
Copy link
Owner

Good job thus far. Here's some feedback

  • GET /posts: all good!
  • GET /posts/:postId : this is pretty good. When you design a REST API route which should return a specific resource (here you want to return a single post), it's more usual to return the object. Right now, this route will return an array (with a single object).
  • Right now, the delete routes don't delete the element from the array. For example, if you try to delete an item and then go to GET /posts, you still get all the posts (even the deleted ones). In order to delete one post, you should remove it from the array. For instance, you could create a new array without the post you want to delete, and assign this value to the posts variable. Look at the Array documentation to see which method you could use: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants