Skip to content

A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.

516 B
Raw Blame
import { NextResponse } from "next/server";

import { normalizeRecursiveJsonSchemasForScalar, openApiDocument } from "@homarr/api/open-api";
import { extractBaseUrlFromHeaders } from "@homarr/common";

export function GET(request: Request) {
  const document = openApiDocument(extractBaseUrlFromHeaders(request.headers));
  if (new URL(request.url).searchParams.get("format") === "scalar") {
    return NextResponse.json(normalizeRecursiveJsonSchemasForScalar(document));
  }
  return NextResponse.json(document);
}