23 lines
699 B
TypeScript
23 lines
699 B
TypeScript
// IMPORTANT: `./otel.js` MUST stay the very first import in this file.
|
|
// The OpenTelemetry NodeSDK can only patch (http, hono, prisma, bullmq,
|
|
// redis, ...) when it loads before those modules are required for the
|
|
// first time. The module is a no-op when OTEL_EXPORTER_OTLP_ENDPOINT is
|
|
// unset, so this contract is safe in every environment.
|
|
import "./otel.js";
|
|
|
|
import { serve } from "@hono/node-server";
|
|
|
|
import { app } from "./app.js";
|
|
import { getApiRuntimeConfig } from "./config.js";
|
|
import { apiLogger } from "./logger.js";
|
|
|
|
serve(
|
|
{
|
|
fetch: app.fetch,
|
|
port: getApiRuntimeConfig().listen.port,
|
|
},
|
|
(info) => {
|
|
apiLogger.info({ port: info.port }, "API listening");
|
|
},
|
|
);
|