2023-04-09 09:36:27 +09:00
|
|
|
# service-bindings
|
|
|
|
|
|
|
|
- Service bindings are an API that facilitate Worker-to-Worker communication via explicit bindings defined in your configuration.
|
2023-06-24 10:19:35 +09:00
|
|
|
- In this example, invoke [hello](https://github.com/syumai/workers/tree/main/_examples/hello) using Service bindings.
|
2023-04-09 09:36:27 +09:00
|
|
|
|
|
|
|
## Development
|
|
|
|
|
|
|
|
### Requirements
|
|
|
|
|
|
|
|
This project requires these tools to be installed globally.
|
|
|
|
|
|
|
|
* wrangler
|
|
|
|
* tinygo
|
|
|
|
|
|
|
|
### Deploy Steps
|
|
|
|
|
2023-06-24 10:19:35 +09:00
|
|
|
1. Deploy [hello](https://github.com/syumai/workers/tree/main/_examples/hello) first.
|
2023-04-09 09:36:27 +09:00
|
|
|
2. Define service bindings in `wrangler.toml`.
|
|
|
|
```toml
|
|
|
|
services = [
|
|
|
|
{ binding = "hello", service = "hello" }
|
|
|
|
]
|
|
|
|
```
|
|
|
|
3. Deploy this example.
|
|
|
|
```
|
|
|
|
make build # build Go Wasm binary
|
2023-05-21 11:56:31 +09:00
|
|
|
make deploy # deploy worker
|
2023-04-09 09:36:27 +09:00
|
|
|
```
|
|
|
|
|
|
|
|
## Documents
|
|
|
|
|
|
|
|
- https://developers.cloudflare.com/workers/runtime-apis/service-bindings/
|