Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(containers): forwarding #239

Merged
merged 2 commits into from
May 18, 2024
Merged

feat(containers): forwarding #239

merged 2 commits into from
May 18, 2024

Conversation

eladb
Copy link
Contributor

@eladb eladb commented May 18, 2024

Introduce an API that allows forwarding various events to containers. Currently only implemented for sim.

The workload.forward() method returns an IForward object with a fromXxx() method for each supported handler type.

For example, this is how you can forward cloud.Api requests:

let work = new containers.Workload(...);
let api = new cloud.Api();
api.get("/my_request", work.forward().fromApi());

You can pass an optional route and method to forward() in order to customize the behavior:

work.forward(route: "/your_request", method: cloud.HttpMethod.PUT);

eladb added 2 commits May 18, 2024 13:59
Introduce an API that allows forwarding various events to containers. Currently only implemented for `sim`.

The `workload.forward()` method returns an `IForward` object with a `fromXxx()` method for each supported handler type.

For example, this is how you can forward `cloud.Api` requests:

```js
let work = new containers.Workload(...);
let api = new cloud.Api();
api.get("/my_request", work.forward().fromApi());
```

You can pass an optional `route` and `method` to `forward()` in order to customize the behavior:

```js
work.forward(route: "/your_request", method: cloud.HttpMethod.PUT);
```
Copy link

mergify bot commented May 18, 2024

Thanks for contributing, @eladb! This PR will now be added to the merge queue, or immediately merged if eladb/forwarders is up-to-date with main and the queue is empty.

@mergify mergify bot merged commit e0acf87 into main May 18, 2024
6 checks passed
@mergify mergify bot deleted the eladb/forwarders branch May 18, 2024 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants