api_controller v0.1.0 ApiController behaviour
Summary
Macros
Defines a controller method with the given name
Macros
Defines a controller method with the given name
Examples
defmethod :create, user_schema do
name = request_params["name"]
show_result(conn, name)
end
defp user_schema do
[
name: [required: true, type: :string],
password: [required: true, type: :string, length: 8..32],
type: [required: true, type: :string, inclusion: ["user", "admin"]]
bio: [type: :string],
age: [type: :integer]
]
end
Callbacks
Render JSON error and status.
Response example: {“status”: “error”, “reason”: “record_not_found”, errors: []}