Module: @ts-rest/express
Classes
Interfaces
Type Aliases
AppRouteImplementation
Ƭ AppRouteImplementation<T
>: T
extends AppRouteMutation
? AppRouteMutationImplementation
<T
> : T
extends AppRouteQuery
? AppRouteQueryImplementation
<T
> : never
Type parameters
Name | Type |
---|---|
T | extends AppRoute |
Defined in
libs/ts-rest/express/src/lib/types.ts:35
AppRouteMutationImplementation
Ƭ AppRouteMutationImplementation<T
>: (input
: ServerInferRequest
<T
, Express
["request"
][``"headers"``]> & { file
: unknown
; files
: unknown
; req
: TsRestRequest
<T
> ; res
: Response
}) => Promise
<ServerInferResponses
<T
>>
Type parameters
Name | Type |
---|---|
T | extends AppRouteMutation |
Type declaration
▸ (input
): Promise
<ServerInferResponses
<T
>>
Parameters
Name | Type |
---|---|
input | ServerInferRequest <T , Express ["request" ][``"headers"``]> & { file : unknown ; files : unknown ; req : TsRestRequest <T > ; res : Response } |
Returns
Promise
<ServerInferResponses
<T
>>
Defined in
libs/ts-rest/express/src/lib/types.ts:26
AppRouteQueryImplementation
Ƭ AppRouteQueryImplementation<T
>: (input
: ServerInferRequest
<T
, Express
["request"
][``"headers"``]> & { req
: TsRestRequest
<T
> ; res
: Response
}) => Promise
<ServerInferResponses
<T
>>
Type parameters
Name | Type |
---|---|
T | extends AppRouteQuery |
Type declaration
▸ (input
): Promise
<ServerInferResponses
<T
>>
Parameters
Name | Type |
---|---|
input | ServerInferRequest <T , Express ["request" ][``"headers"``]> & { req : TsRestRequest <T > ; res : Response } |
Returns
Promise
<ServerInferResponses
<T
>>
Defined in
libs/ts-rest/express/src/lib/types.ts:19
TsRestExpressOptions
Ƭ TsRestExpressOptions<T
>: Object
Type parameters
Name | Type |
---|---|
T | extends AppRouter |
Type declaration
Name | Type |
---|---|
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:91
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
Name | Type |
---|---|
T | extends AppRouter | AppRoute |
F | extends FlattenAppRouter <T > = FlattenAppRouter <T > |
S | extends ServerInferRequest <F > = ServerInferRequest <F > |
Defined in
libs/ts-rest/express/src/lib/types.ts:42
TsRestRequestHandler
Ƭ TsRestRequestHandler<T
>: (req
: TsRestRequest
<T
>, res
: Response
, next
: NextFunction
) => void
Type parameters
Name | Type |
---|---|
T | extends AppRouter | AppRoute |
Type declaration
▸ (req
, res
, next
): void
Parameters
Name | Type |
---|---|
req | TsRestRequest <T > |
res | Response |
next | NextFunction |
Returns
void
Defined in
libs/ts-rest/express/src/lib/types.ts:58
Functions
createExpressEndpoints
▸ createExpressEndpoints<TRouter
>(schema
, router
, app
, options?
): void
Type parameters
Name | Type |
---|---|
TRouter | extends AppRouter |
Parameters
Name | Type |
---|---|
schema | TRouter |
router | RouterImplementation <TRouter > |
app | IRouter |
options | TsRestExpressOptions <TRouter > |
Returns
void
Defined in
libs/ts-rest/express/src/lib/ts-rest-express.ts:294
initServer
▸ initServer(): Object
Returns
Object
Name | Type |
---|---|
route | <T, TRoute>(contract : T , route : TRoute ) => TRoute |
router | <T, TRouter>(contract : T , router : TRouter ) => TRouter |
Defined in
libs/ts-rest/express/src/lib/ts-rest-express.ts:30