covenix / serve
Function: serve()
serve(
api,options?):Promise<Server<typeofIncomingMessage, typeofServerResponse>>
Defined in: src/express.ts:141
Builds the app with toExpress and starts listening, resolving once the server is up (or rejecting on a bind error). Returns the Node http.Server — so you can attach a WebSocketServer({ server }), close it for graceful shutdown, etc. Like toExpress, this is opt-in convenience.
Parameters
api
options?
ServeOptions = {}
Returns
Promise<Server<typeof IncomingMessage, typeof ServerResponse>>
Example
ts
const server = await serve(api, { port: 3000, configure: (a) => a.use(cors()) });
// server is a http.Server — attach websockets, close on shutdown, …