createTRPCRequestHandler()
Create a RequestHandler
for SvelteKit +server.ts
, e.g. GET, POST, etc.
Example file location: src/routes/api/trpc/[...trpc]/+server.ts
If endpoint
isn't specified, it will be inferred from the pathname.
e.g. if pathname is '/api/trpc/,a,b,c', where '/a,b,c' are params, the endpoint should be calculated as '/api/trpc'
Signature
createTRPCRequestHandler<TRouter, TRouteParams, TRouteId>(options: TRPCHandleOptions<TRouter, TRouteParams, TRouteId>): RequestHandler<TRouteParams, TRouteId>;
Type parameters
TRouter
extendsRouter
<AnyRouterDef
<AnyRootConfig
,any
>,TRouter
>TRouteParams
extendsPartial
<Record
<string
,string
>> =Partial
<Record
<string
,string
>>TRouteId
extendsnull
|string
=null
|string
Parameters
Name | Type |
---|---|
options | TRPCHandleOptions <TRouter , TRouteParams , TRouteId > |
Returns
RequestHandler
<TRouteParams
, TRouteId
>
Defined in: requestHandler.ts:13