Skip to content

Services

Services are the top-level abstraction in MiniGateway. They group routes, upstreams, and plugins together.

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[];
}
Terminal window
curl http://localhost:8080/api/services
Terminal window
curl http://localhost:8080/api/services/service_abc123
Terminal window
curl -X PATCH http://localhost:8080/api/services/service_abc123 \
-H "Content-Type: application/json" \
-d '{
"retries": 5,
"tags": ["production"]
}'
Terminal window
curl -X DELETE http://localhost:8080/api/services/service_abc123

Bind plugins to apply them to all routes under a service:

Terminal window
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
}
}'

Filter services by name or tags:

Terminal window
# Search by name
curl "http://localhost:8080/api/services?name=api"
# Filter by protocol
curl "http://localhost:8080/api/services?protocol=https"
  • Routes - Define routing rules for services
  • Plugins - Add functionality to services
  • Upstreams - Configure backend servers