onConfigure

Introduction

The onConfigure hook is called after the server was configured using the configure method. It should return a Promise.

Default configuration

If configure() is never called, you can get the default configuration by importing it:

import { defaultConfiguration } from '@hocuspocus/server'

Hook payload

The data passed to the onConfigure hook has the following attributes:

import { Configuration } from '@hocuspocus/server'

const data = {
  configuration: Configuration,
  version: string,
  instance: Hocuspocus,
}

Example

import { Server } from '@hocuspocus/server'

const server = Server.configure({
  async onConfigure(data) {
    // Output some information
    console.log(`Server was configured!`)
  },
})

server.listen()