Services
此内容尚不支持你的语言。
Services are the top-level abstraction in MiniGateway. They group routes, upstreams, and plugins together.
Service Structure
Section titled “Service Structure”interface Service { id: string; name: string; protocol?: string; // "http" | "https" host?: string; port?: number; path?: string; connectTimeout?: number; // milliseconds writeTimeout?: number; // milliseconds readTimeout?: number; // milliseconds retries?: number; tags?: string[];}Creating Services
Section titled “Creating Services”Timeout Configuration
Section titled “Timeout Configuration”Managing Services
Section titled “Managing Services”List All Services
Section titled “List All Services”curl http://localhost:8080/api/servicesGet a Specific Service
Section titled “Get a Specific Service”curl http://localhost:8080/api/services/service_abc123Update a Service
Section titled “Update a Service”curl -X PATCH http://localhost:8080/api/services/service_abc123 \ -H "Content-Type: application/json" \ -d '{ "retries": 5, "tags": ["production"] }'Delete a Service
Section titled “Delete a Service”curl -X DELETE http://localhost:8080/api/services/service_abc123Service-Level Plugins
Section titled “Service-Level Plugins”Bind plugins to apply them to all routes under a service:
curl -X POST http://localhost:8080/api/plugins \ -H "Content-Type: application/json" \ -d '{ "serviceId": "service_abc123", "pluginName": "rate-limit", "config": { "limit": 1000, "window": 60 } }'Search Services
Section titled “Search Services”Filter services by name or tags:
# Search by namecurl "http://localhost:8080/api/services?name=api"
# Filter by protocolcurl "http://localhost:8080/api/services?protocol=https"