Open gaand opened 7 years ago
After mentioning them in Rails, I'd like to see them recapitulated with nuance:
Break verb equivalence. For example, a PATCH to a main resource may actually be an INSERT INTO or DELETE FROM a join resource. If the semantics don't make sense for POST or DELETE on the join, the PATCH on main is necessary even if the action is accomplished by inserting or removing something from a the datastore. This is still RESTful; if you find someone who disagrees, they probably don't understand REST.
Models (and persisted objects) are not necessarily tied to controllers or vice-versa. For example, I may have a controller that works with a third-party service, or one that isn't backed by a datastore (a datacleaner model, for example, these are typically called "service objects"). Or, more commonly, in express, we use an embedded document. So the temptation is for the developer to access a User
's Post
s from GET /users
when in actuality it should be GET /posts
, even though the controller action responsible for the latter uses the User
schema to do its querying.
YASSS
🤖 🎉
See ga-wdi-boston/rails-api#29