一键导入
builderx-api-controllers
Guide to Phoenix Controller structure in builderx_api using FallbackController and standard tuple responses.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Guide to Phoenix Controller structure in builderx_api using FallbackController and standard tuple responses.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Phoenix Channel patterns in landing_page_backend — real-time collaboration, WebSocket topics, broadcasting, and channel structure.
Guide to Context module patterns in landing_page_backend — Ecto queries, dynamic query building, Ecto.Multi, and Outbox messaging.
Guide to Phoenix Controller structure in landing_page_backend using FallbackController, tuple responses, and permission plugs.
Patterns for creating Oban background workers in landing_page_backend — queue configuration, job arguments, retry strategies, and dynamic query processing.
Custom Plug middleware patterns in landing_page_backend — authentication (JWT/Passport), authorization, permission checking, and rate limiting.
Guidelines for creating Ecto Schemas in landing_page_backend, including binary UUID primary keys, virtual fields, custom json/1 function, and multiple changeset patterns.
| name | builderx_api-controllers |
| description | Guide to Phoenix Controller structure in builderx_api using FallbackController and standard tuple responses. |
| metadata | {"author":"Vũ Lưu","version":"2026.03.25","source":"Source code builderx_api"} |
Conventions for handling HTTP requests and responses at the Web API layer.
| Topic | Description | Reference |
|---|---|---|
| FallbackController | Centralized response handling via tuples | core-fallback |
| Tuple Returns | Standard formats like {:success, ...} or {:failed, ...} | core-fallback |
defmodule BuilderxApiWeb.V1.ExampleController do
use BuilderxApiWeb, :controller
def show(conn, %{"id" => id}) do
# Context functions should return tuples compatible with FallbackController instead of standard {:ok, data}
# Example:
{:success, :with_data, %{id: id, name: "Sample"}}
end
def delete(conn, _params) do
# Return success without data
{:success, :success_only}
end
def create(conn, _params) do
# Return failure with a custom reason
{:failed, :with_reason, "Invalid input data"}
# Or return an error from a Changeset validation failure
# {:error, changeset}
end
end