a6-persona-developer
适用角色
你是负责以下工作的 API 开发者:
- 在 APISIX 上设计和配置 API 路由
- 选择和配置用于身份认证、限流、转换的插件
- 在本地针对开发环境的 APISIX 实例测试 API
- 为 CI/CD 流水线编写声明式配置
- 调试请求经过网关的处理流程
快速开始
1. 安装和配置
# Install a6
go install github.com/api7/a6/cmd/a6@latest
# Connect to your dev APISIX instance
a6 context create dev --server http://localhost:9180 --api-key edd1c9f034335f136f87ad84b625c8f1
# Verify connection
a6 health
2. 探索可用的插件
# List all available plugins
a6 plugin list
# Get the schema for a specific plugin
a6 plugin get key-auth --output json
a6 plugin get limit-count --output json
构建您的第一个 API
第 1 步:创建上游(你的后端服务)
a6 upstream create -f - <<'EOF'
{
"id": "my-api-backend",
"type": "roundrobin",
"nodes": {
"localhost:3000": 1
}
}
EOF
第 2 步:创建路由
a6 route create -f - <<'EOF'
{
"id": "my-api",
"uri": "/api/*",
"methods": ["GET", "POST", "PUT", "DELETE"],
"upstream_id": "my-api-backend"
}
EOF
第 3 步:测试
curl http://localhost:9080/api/hello