Skip to main content

CoreServer

The CoreServer class is used as a basis for creating new servers. It uses Server class from the @hapi/hapi package. The CoreServer class provides a set of methods that can be used when creating a new server. Additionally there are methods that have to be implemented by classes that extend from CoreServer class.

Following methods are provided:

NameDescription
initializeDirectoriesInitializes staticPath field.
createServerCreates a new Server instance from the @hapi/hapi package based on the project configuration. The Server instance is stored in the server field.
registerRoutesAssociates the route config with correct controller handler methods.
registerModulesRegisters provided modules.
registerServicesRegisters provided services.
registerControllersRegisters provided controllers. Initialized controllers are stored in the controllers field.
registerPluginsRegisters provided plugins.
initConfiguration initialization (loads the archibald config into the ConfigManager).
startNot implemented. It has to be implemented in the project.
stopStops the underlying hapi server, logs the shutdown and exits the process.
disposeStops the underlying hapi server without exiting the process.