Skip to content

Commit 3dc697f

Browse files
dmstoykovGabrola
andauthored
feat(fastify): pass appRoute to route handlers (#591)
Co-authored-by: Youssef Gaber <1728215+Gabrola@users.noreply.github.com>
1 parent 0f1ca8a commit 3dc697f

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

.changeset/mighty-bears-explain.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@ts-rest/fastify': minor
3+
---
4+
5+
Pass `appRoute` to route handlers

libs/ts-rest/fastify/src/lib/ts-rest-fastify.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ type AppRouteImplementation<T extends AppRoute> = (
3131
input: ServerInferRequest<T, fastify.FastifyRequest['headers']> & {
3232
request: fastify.FastifyRequest;
3333
reply: fastify.FastifyReply;
34+
appRoute: T;
3435
},
3536
) => Promise<ServerInferResponses<T>>;
3637

@@ -228,6 +229,7 @@ const registerRoute = <TAppRoute extends AppRoute>(
228229
// eslint-disable-next-line @typescript-eslint/no-explicit-any
229230
body: validationResults.bodyResult.data as any,
230231
reply,
232+
appRoute,
231233
});
232234
} catch (e) {
233235
if (e instanceof TsRestResponseError) {

0 commit comments

Comments
 (0)