add README.md 文档
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
# Example Worker 插件
|
||||
|
||||
演示 `@rpc_method` 与显式模型绑定的用法。
|
||||
|
||||
## 实现的功能
|
||||
|
||||
- 加、减、乘、除四则运算(GET / POST)
|
||||
- 基于 `modelvault` 的访问计数器
|
||||
|
||||
## 如何工作
|
||||
|
||||
1. 配置位于 `config/workers/example/*.toml`
|
||||
2. 模型由 `gen_models` 生成,位于 `models/pydantic.py`
|
||||
3. 路由实现在 `router/` 下,使用 `@rpc_method` 装饰
|
||||
4. 工厂函数 `create_workers` 初始化数据库并启动 Worker
|
||||
|
||||
## 调用示例
|
||||
|
||||
```bash
|
||||
curl "http://localhost:8000/api/v1/calc/add?a=3&b=4"
|
||||
# {"result":7,"operation":"add","timestamp":...}
|
||||
```
|
||||
Reference in New Issue
Block a user