@sms/host-node
Interfaces
NodeHostOptions
Defined in: packages/drivers/host/node/src/index.ts:6
Properties
host?
optional host?: string;
Defined in: packages/drivers/host/node/src/index.ts:8
port?
optional port?: number;
Defined in: packages/drivers/host/node/src/index.ts:7
Functions
createNodeHost()
function createNodeHost(opts?): Host;
Defined in: packages/drivers/host/node/src/index.ts:41
node:http host. port: 0 picks a free port (tests).
Parameters
| Parameter | Type |
|---|---|
opts | NodeHostOptions |
Returns
sendResponse()
function sendResponse(res, response): Promise<void>;
Defined in: packages/drivers/host/node/src/index.ts:29
Write a fetch Response to the socket, streaming the body chunk by chunk (SSE, large files). A client
that goes away mid-stream ends the write quietly: that is not a failure of the request.
Parameters
| Parameter | Type |
|---|---|
res | ServerResponse |
response | Response |
Returns
Promise<void>
toRequest()
function toRequest(req, fallbackHost?): Promise<Request>;
Defined in: packages/drivers/host/node/src/index.ts:12
Turn a Node request into a fetch Request. Exported so other Node-based hosts can reuse it.
Parameters
| Parameter | Type | Default value |
|---|---|---|
req | IncomingMessage | undefined |
fallbackHost | string | '127.0.0.1' |
Returns
Promise<Request>