Skip to content

Commit 8f047a7

Browse files
mwillbanksCopilot
andauthored
Apply copilot suggestions
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent fe59ca9 commit 8f047a7

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

versioned_docs/version-3.x/reference/server-adapters/custom.mdx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ import type { RequestContext } from '@zenstackhq/server/types';
4040

4141
interface NodeAdapterOptions<Schema extends SchemaDef> extends CommonAdapterOptions<Schema> {
4242
prefix?: string;
43-
getClient(request: IncomingMessage, response: ServerResponse):
44-
| ClientContract<Schema>
45-
| Promise<ClientContract<Schema>>;
43+
getClient(request: IncomingMessage, response: ServerResponse): ClientContract<Schema> | Promise<ClientContract<Schema>>;
4644
}
4745

4846
export function createNodeAdapter<Schema extends SchemaDef>(
@@ -125,7 +123,7 @@ createServer(
125123
createNodeAdapter({
126124
prefix: '/api',
127125
apiHandler: handler,
128-
getClient: () => /* return a tenant-aware ZenStack client */,
126+
getClient: (req, res) => /* return a tenant-aware ZenStack client based on req */,
129127
}),
130128
).listen(3000);
131129
```

versioned_docs/version-3.x/service/api-handler/custom.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ description: Extend or implement ZenStack API handlers to match your backend con
99

1010
## Overview
1111

12-
ZenStack ships ready-to-use REST and RPC handlers, but you can tailor their behavior or author brand new handlers without leaving TypeScript. The server package exposes the handler contracts through `@zenstackhq/server/types`, utility helpers from `@zenstackhq/server/api`, all built-in handlers expose their methods as `protected` to allow for extension points. You can:
12+
ZenStack ships ready-to-use REST and RPC handlers, but you can tailor their behavior or author brand new handlers without leaving TypeScript. The server package exposes the handler contracts through `@zenstackhq/server/types` and utility helpers from `@zenstackhq/server/api`. All built-in handlers expose their methods as `protected` to allow for extension points. You can:
1313

14-
- override parts of the REST or RPC pipeline (filtering, serialization, validation, error handling, and more);
15-
- wrap the default handlers with extra behavior (multi-tenancy, telemetry, custom logging);
16-
- implement a handler from scratch while still benefiting from ZenStack's schema and serialization helpers.
14+
- override parts of the REST or RPC pipeline (filtering, serialization, validation, error handling, and more)
15+
- wrap the default handlers with extra behavior (multi-tenancy, telemetry, custom logging)
16+
- implement a handler from scratch while still benefiting from ZenStack's schema and serialization helpers
1717

1818
## Core building blocks
1919

0 commit comments

Comments
 (0)