zuplo

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Critical Patterns

关键模式

Route Configuration (REQUIRED)

路由配置(必填)

json
{
  "routes": [
    {
      "path": "/api/users",
      "methods": ["GET", "POST"],
      "handler": {
        "module": "$import(@zuplo/runtime)",
        "export": "urlRewriteHandler",
        "options": {
          "rewritePattern": "https://api.example.com/users"
        }
      },
      "policies": {
        "inbound": ["rate-limit", "api-key-auth"]
      }
    }
  ]
}
json
{
  "routes": [
    {
      "path": "/api/users",
      "methods": ["GET", "POST"],
      "handler": {
        "module": "$import(@zuplo/runtime)",
        "export": "urlRewriteHandler",
        "options": {
          "rewritePattern": "https://api.example.com/users"
        }
      },
      "policies": {
        "inbound": ["rate-limit", "api-key-auth"]
      }
    }
  ]
}

API Key Auth (REQUIRED)

API密钥认证(必填)

typescript
// ✅ ALWAYS: Use built-in API key authentication
export default {
  policies: {
    inbound: [
      {
        name: "api-key-auth",
        policyType: "api-key-inbound",
        handler: {
          export: "ApiKeyInboundPolicy",
          module: "$import(@zuplo/runtime)"
        }
      }
    ]
  }
};

typescript
// ✅ 务必:使用内置的API密钥认证
export default {
  policies: {
    inbound: [
      {
        name: "api-key-auth",
        policyType: "api-key-inbound",
        handler: {
          export: "ApiKeyInboundPolicy",
          module: "$import(@zuplo/runtime)"
        }
      }
    ]
  }
};

Decision Tree

决策树

Need auth?                 → Use api-key-inbound policy
Need rate limiting?        → Use rate-limit policy
Need caching?              → Use cache policy
Need transforms?           → Use custom policy handler
Need monitoring?           → Enable analytics

需要认证?                 → 使用api-key-inbound策略
需要速率限制?        → 使用rate-limit策略
需要缓存?              → 使用cache策略
需要转换?           → 使用自定义策略处理程序
需要监控?           → 启用分析功能

Resources

资源

  • Gateway Setup: gateway-setup.md
  • GitOps: gitops.md
  • Performance: performance.md
  • Security: security.md
  • 网关设置gateway-setup.md
  • GitOpsgitops.md
  • 性能优化performance.md
  • 安全防护security.md