Files
chongming-config/workers/example/add.toml
T

34 lines
1.0 KiB
TOML
Raw Normal View History

2026-07-22 17:15:16 +08:00
# add 接口 — 按请求类型分节
# subject 会带上方法后缀: example.add.GET / example.add.POST
[GET]
cacheable = true
summary = "Add two numbers"
docstring = "Add two numbers via GET query params"
params = ["a: float", "b: float"]
auth_required = false
[GET.response_model]
result = { type = "float", required = true }
operation = { type = "str", default = "add" }
timestamp = { type = "float", required = false, default = 0.0 }
[POST]
cacheable = true
summary = "Add two numbers (POST)"
docstring = "Add two numbers via POST JSON body"
params = ["a: float", "b: float"]
2026-07-23 17:46:30 +08:00
auth_required = true
2026-07-22 17:15:16 +08:00
[POST.response_model]
result = { type = "float", required = true }
operation = { type = "str", default = "add" }
timestamp = { type = "float", required = false, default = 0.0 }
2026-07-27 14:26:48 +08:00
# --- MQTT 端点(不注册 HTTP 路由,仅通过 MQTT chongming/example/add 调用)---
[MQTT]
summary = "Add two numbers via MQTT"
docstring = "通过 MQTT 主题 chongming/example/add 调用,载荷为 JSON"
params = ["a: float", "b: float"]
auth_required = false