Skip to content

Commit

Permalink
Update events.md
Browse files Browse the repository at this point in the history
  • Loading branch information
DianomiJH committed Nov 23, 2023
1 parent a6d9b01 commit 77dc2b4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion www/docs/events.md
Expand Up @@ -60,14 +60,23 @@ In your application you can define events. This definition provides validation u


```ts title="packages/core/src/todo.ts"
import { event } from "./events";
import { createEventBuilder } from "sst/node/event-bus";

const event = createEventBuilder({
bus: "bus",
});

export const Events = {
Created: event("todo.created", {
id: z.string(),
}),
};
```

:::info
Note that the `"bus"` string passed to the `createEventBuilder` is the same ID as provided in the EventBus construct in MyStack.ts above
:::

---

## Define subscriber
Expand Down

0 comments on commit 77dc2b4

Please sign in to comment.