17 lines
457 B
TypeScript
17 lines
457 B
TypeScript
import { createServer, IncomingMessage, ServerResponse } from "http";
|
|
import { registerRoutes } from "./routes";
|
|
import { WebApi, WebApiDependencies } from "./api";
|
|
|
|
export function createWebServer(deps: WebApiDependencies, port = 3000) {
|
|
const api = new WebApi(deps);
|
|
const server = createServer();
|
|
|
|
registerRoutes(server, api);
|
|
|
|
server.listen(port, () => {
|
|
// no-op: startup is handled by the manager
|
|
});
|
|
|
|
return server;
|
|
}
|