API设计
设计理念:
- 思考是否添加“s“
- 方法名是否具体如:get 有情况可能查1个/多个
发送验证码
- 资源:validation_codes
- 动作:create(POST)
- 状态码:200 | 201 | 422 | 429
422:格式错误、429:过于频繁
登入登出
- 资源:session
- 动作:create | destroy
- 状态码:200 | 422
当前用户
资源:me
动作:show(GET)
记账数据
- 资源:items
- 动作:create | update | show | index | destroy
标签
- 资源:tags
- 动作:create | update | show | index | destroy
打标签
- 资源:taggings
- 动作:create | index | destroy
创建表
bin/rails g model ValidationCode email:string kind:integer used_at:datetime
命名空间
controller、routes
bin/rails g controller api::v1::validation_codes create