plural vs singular - There's a lot of nuance here. Most people I've worked with prefer that thing/{id} returns a single thing, while things/ returns all things. As most things go, consistency is more important than what you ultimately choose here.|
verbs - Some apis (like AWS) are only verbs. Again, the important part is consistency. Choose one and don't mix unless it's important.
I Agree
Return good error statuses (be mindful with 401/403 and 5xx, they sometimes leak information)
Frameworks: Pick one and just go. However, be aware that you will eventually hate whichever one you picked.
I like to think about plural vs singular by what that part of the url means, if it's an entity, a plural makes sense, you're not saying "I want all the posts", it's more like "I want to interact with the entity 'Posts'", with a GET at "/" being all/pagination, "/:id" being a singular fetch, Posting to a entity would be making a create request and what not.
I like this approach because it lowers variance, and imo easier to abstract for the frontend, instead of having to manually pick the singular/plural form, you can have just one word to refer to all the entity CRUD operations
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I Disagree with:
thing/{id}
returns a single thing, whilethings/
returns all things. As most things go, consistency is more important than what you ultimately choose here.|I Agree
Especially the last sentence of the last bullet.
I like to think about plural vs singular by what that part of the url means, if it's an entity, a plural makes sense, you're not saying "I want all the posts", it's more like "I want to interact with the entity 'Posts'", with a GET at "/" being all/pagination, "/:id" being a singular fetch, Posting to a entity would be making a create request and what not.
I like this approach because it lowers variance, and imo easier to abstract for the frontend, instead of having to manually pick the singular/plural form, you can have just one word to refer to all the entity CRUD operations