Skip to main content

Module: @ts-rest/express

Classes​

Interfaces​

Type Aliases​

AppRouteImplementation​

Ƭ AppRouteImplementation<T>: T extends AppRouteMutation ? AppRouteMutationImplementation<T> : T extends AppRouteQuery ? AppRouteQueryImplementation<T> : never

Type parameters​

NameType
Textends AppRoute

Defined in​

libs/ts-rest/express/src/lib/types.ts:34


TsRestExpressOptions​

Ƭ TsRestExpressOptions<T>: Object

Type parameters​

NameType
Textends AppRouter

Type declaration​

NameType
globalMiddleware?TsRestRequestHandler<FlattenAppRouter<T>>[]
jsonQuery?boolean
logInitialization?boolean
requestValidationErrorHandler?"default" | "combined" | (err: RequestValidationError, req: TsRestRequest<FlattenAppRouter<T>>, res: Response, next: NextFunction) => void
responseValidation?boolean

Defined in​

libs/ts-rest/express/src/lib/types.ts:90


TsRestRequest​

Ƭ TsRestRequest<T, F, S>: Request<"params" extends keyof S ? S["params"] : Express["request"][``"params"``], ServerInferResponseBody<F>, "body" extends keyof S ? S["body"] : Express["request"][``"body"``], "query" extends keyof S ? S["query"] : Express["request"][``"query"``]> & { headers: "headers" extends keyof S ? S["headers"] : Express["request"][``"headers"``] ; tsRestRoute: F }

Type parameters​

NameType
Textends AppRouter | AppRoute
Fextends FlattenAppRouter<T> = FlattenAppRouter<T>
Sextends ServerInferRequest<F> = ServerInferRequest<F>

Defined in​

libs/ts-rest/express/src/lib/types.ts:41


TsRestRequestHandler​

Ƭ TsRestRequestHandler<T>: (req: TsRestRequest<T>, res: Response, next: NextFunction) => void

Type parameters​

NameType
Textends AppRouter | AppRoute

Type declaration​

â–¸ (req, res, next): void

Parameters​
NameType
reqTsRestRequest<T>
resResponse
nextNextFunction
Returns​

void

Defined in​

libs/ts-rest/express/src/lib/types.ts:57

Functions​

createExpressEndpoints​

â–¸ createExpressEndpoints<TRouter>(schema, router, app, options?): void

Type parameters​

NameType
TRouterextends AppRouter

Parameters​

NameType
schemaTRouter
routerRecursiveRouterObj<TRouter>
appIRouter
optionsTsRestExpressOptions<TRouter>

Returns​

void

Defined in​

libs/ts-rest/express/src/lib/ts-rest-express.ts:273


initServer​

â–¸ initServer(): Object

Returns​

Object

NameType
route<T>(route: T, args: AppRouteImplementationOrOptions<T>) => AppRouteImplementationOrOptions<T>
router<T>(router: T, args: RecursiveRouterObj<T>) => RecursiveRouterObj<T>

Defined in​

libs/ts-rest/express/src/lib/ts-rest-express.ts:30