Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

@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

ParameterType
optsNodeHostOptions

Returns

Host


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

ParameterType
resServerResponse
responseResponse

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

ParameterTypeDefault value
reqIncomingMessageundefined
fallbackHoststring'127.0.0.1'

Returns

Promise<Request>