@crossdelta/platform-sdk 0.3.7 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -87,6 +87,23 @@ export default handleEvent(
|
|
|
87
87
|
)
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
+
### Service Folder Structure
|
|
91
|
+
|
|
92
|
+
Organize service code with this structure:
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
src/
|
|
96
|
+
├── index.ts # Entry point with telemetry, Hono app, NATS setup
|
|
97
|
+
├── handlers/ # Event handlers (*.event.ts files for NATS events)
|
|
98
|
+
│ └── order-created.event.ts
|
|
99
|
+
└── use-cases/ # Business logic / use cases
|
|
100
|
+
└── send-notification.use-case.ts
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
- **`src/handlers/`**: Event handlers that consume CloudEvents from NATS
|
|
104
|
+
- **`src/use-cases/`**: Reusable business logic (pure functions or classes)
|
|
105
|
+
- Keep `src/index.ts` focused on wiring (server, consumers, routes)
|
|
106
|
+
|
|
90
107
|
Start consumption in `src/index.ts` (NOT in a separate file):
|
|
91
108
|
|
|
92
109
|
```ts
|