TrpcAdapterBaseContext
@h4ad/serverless-adapter > TrpcAdapterBaseContext
(interface) TrpcAdapterBaseContext
The context created by this library that allows getting some information from the request and setting the status and header of the response.
Signature:
export interface TrpcAdapterBaseContext
(method) getHeader
The method to return the value of some header from the request
Signature:
getHeader(name: string): string | undefined;
Parameters
Parameter | Type | Description |
---|---|---|
name | string | The name of the header |
Returns:
string | undefined
(method) getHeaders
The method to return the request headers
Signature:
getHeaders(): SingleValueHeaders;
Returns:
(method) getIp
The method to return user's address
Signature:
getIp(): string | undefined;
Returns:
string | undefined
(method) getMethod
The method to return the HTTP Method in the request
Signature:
getMethod(): string | undefined;
Returns:
string | undefined
(method) getUrl
The method to return the URL called
Signature:
getUrl(): string | undefined;
Returns:
string | undefined
(method) removeHeader
The method to remove some header from the response
Signature:
removeHeader(name: string): void;
Parameters
Parameter | Type | Description |
---|---|---|
name | string | The name of the header |
Returns:
void
(property) request
The request object that will be forward to your app
Signature:
request: IncomingMessage;
(property) response
The response object that will be forward to your app to output the response
Signature:
response: ServerResponse;
(method) setHeader
The method to set some header in the response
Signature:
setHeader(name: string, value: number | string): void;
Parameters
Parameter | Type | Description |
---|---|---|
name | string | The name of the header |
value | number | string | The value to be set in the header |
Returns:
void
(method) setStatus
The method to set response status.
Signature:
setStatus(statusCode: number): void;
Parameters
Parameter | Type | Description |
---|---|---|
statusCode | number | The response status that you want |
Returns:
void