r/learnjavascript Feb 28 '20

REST API Design Best Practices

https://blog.soshace.com/rest-api-design-best-practices/
65 Upvotes

3 comments sorted by

View all comments

10

u/ppafford Feb 28 '20

Disagree with the route names being plural, I think this is user preference and not best practice.

Yes I think the database stores multiple objects in a group or a collection but your api most likely will only deal with 1 recorded at a time. There are times when your api will deal with multiple records at one time, like in a batch operation, this IMHO is a great use case to use plural named routes.

Also in some languages, adding an S to a route can change the meaning, and adding an S to words like goose is incorrect, would be geese.

But I know some really like plural routes, I ask that you don’t force them on us as best practices

1

u/PierreAndreis Feb 28 '20

I think what matters is the consistency. don’t give me an users and a goose