🐑 Commons Host



JavaScript API

Table of Contents


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

The configuration argument contains:


await server.listen()

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


await server.close()

Shuts down the workers and redirecting server gracefully.


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.