Service Binding
Bind your API to a service as Workers, so you can use the Workers capabilities within your API.
Overview
Example Service
export default class Service {
async fetch(request, env, ctx) {
return new Response("Hello from Worker 1!", {
headers: { "content-type": "text/plain" },
});
}
}API Configuration
{
"$schema": "./api-config.schema.json",
"title": "API Gateway Config",
"description": "Configuration for the Serverless API Gateway",
"services": [
{
"alias": "endpoint1",
"entrypoint": "./services/endpoint1"
}
],
"paths": [
{
"method": "GET",
"path": "/api/v1/endpoint1",
"integration": {
"type": "service",
"binding": "endpoint1"
}
}
]
}Explanation
How to Use
Benefits of Service Binding
Conclusion
Last updated