Connectum API Reference / @connectum/core / createServer
Function: createServer()
createServer(
options):Server
Defined in: packages/core/src/Server.ts:280
Create a new server instance
Returns an unstarted server. Call server.start() to begin accepting connections.
Parameters
options
Server configuration options
Returns
Unstarted server instance
Example
typescript
import { createServer } from '@connectum/core';
import { Healthcheck, healthcheckManager, ServingStatus } from '@connectum/healthcheck';
import { Reflection } from '@connectum/reflection';
const server = createServer({
services: [myRoutes],
protocols: [Healthcheck({ httpEnabled: true }), Reflection()],
shutdown: { autoShutdown: true },
});
server.on('ready', () => {
healthcheckManager.update(ServingStatus.SERVING);
});
await server.start();