- Building Microservices with Go
- Nic Jackson
- 101字
- 2021-07-15 17:28:07
Controller
A controller resource is like a procedure, this is typically used when a resource cannot be mapped to standard CRUD (create, retrieve, update, and delete) functions.
The names for controllers appear as the last segment in a URI path with no child resources. If the controller requires parameters, these would typically be included in the query string:
POST /cats/1/feed -> Feed cat 1
POST /cats/1/feed?food=fish ->Feed cat 1 a fish
When defining a controller name we should always use a verb. A verb is a word that indicates an action or a state of being, such as feed or send.
推薦閱讀