Service. ServiceHost

new ServiceHost()

Parameters:
NameTypeAttributesDefaultDescription
options.corsObject

Cors to be passed to express via the cors package

options.trust_proxyboolean<optional>
false

When true, the server will parse forwarding headers. This should be set when running behind a load-balancer for accurate error messages and logging

options.listenUristring<optional>
http://0.0.0.0:4000

The uri of the host interface to tell express to listen on. Defaults to `http://0.0.0.0:4001

options.i2pEnabledboolean<optional>
false

When true, this server will be available over i2p

options.i2pSamHoststring<optional>
127.0.0.1

The hostname of the i2p SAM control API. Defaults to 127.0.0.1

options.i2pSamPortInteger<optional>
7656

The port of the i2p SAM control API. Defaults to 7656

options.i2pForwardHoststring<optional>
localhost

Override i2p forward host. This defaults to localhost and typically doesn't need to be changed

options.i2pForwardPortInteger

Override i2p forward post. This defaults to the port supplied in options.listenUri.

options.i2pKeystring

When set this i2p key will be used to host the service. If not set a new i2p key will be generated. Defaults to null

options.wsEnabledboolean<optional>
true

When true the server will host a dataparty websocket service. Defaults to true

options.wsPortInteger

Port for the websocket service to listen on. Defaults to null, using the same port as the http server.

options.wsUpgradePathstring<optional>
/ws

The path within the http server to host an upgradeable websocket. Defaults to /ws

options.mdnsEnabledboolean<optional>
true

When true, the server will publish mDNS records advertising the service and party identity

options.runnermodule:Service.ServiceRunner

A pre-configured runner

Members

(static) apiApp :Express

Express app

Type:
  • Express

(static) router :Router

The router

Type:
  • Router

(static) runner :module:Service.ServiceRunner

Dataparty service runner

Methods

(async, static) start()

Start hosting services

(async, static) stop()

Stop hosting services