🐑 Commons Host

Documentation

@commonshost/server

JavaScript API

Table of Contents

Constructor

const {Master} = require('@commonshost/server')
const server = new Master(configuration)

The configuration argument contains:

Starting

await server.listen()

Loads the configuration and spawns worker processes to listen for incoming connections. Also starts a redirecting server from HTTP to HTTPS.

Stopping

await server.close()

Shuts down the workers and redirecting server gracefully.

Reloading

await server.reload()

Starts new workers to gracefully replace the old ones without downtime. Reloads the configuration.

Run-Time Updates

await server.message(message)

Invalidates cached information about files, certificates, and configuration on a per-domain level. Used to update at run-time without the performance cost of a full reload. See Messaging for details.