All files / src app.ts

100% Statements 16/16
50% Branches 1/2
100% Functions 1/1
100% Lines 16/16

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 241x           39x 39x 39x 39x 39x 39x   39x 39x 39x 39x 39x 39x 39x   39x 39x  
import multipart from "@fastify/multipart";
import Fastify from "fastify";
import { registerErrorHandler } from "@ontrack/backend-common";
import type { AppConfig } from "./config.js";
import { registerRoutes } from "./routes/index.js";
 
export async function buildApp(config: AppConfig) {
  const app = Fastify({
    logger: {
      level: config.nodeEnv === "production" ? "info" : "debug",
    },
  });
 
  registerErrorHandler(app);
  await app.register(multipart, {
    limits: {
      fileSize: 52 * 1024 * 1024,
    },
  });
  await registerRoutes(app, config);
 
  return app;
}