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 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | "use client";
import dynamic from "next/dynamic";
import Link from "next/link";
import { ArrowLeft } from "lucide-react";
import { useEffect, useState } from "react";
import "@scalar/api-reference-react/style.css";
const ApiReferenceReact = dynamic(
() => import("@scalar/api-reference-react").then((m) => m.ApiReferenceReact),
{ ssr: false },
);
const IS_STATIC = process.env.NEXT_PUBLIC_STATIC_EXPORT === "true";
const SPEC_URL = IS_STATIC
? "/MinimumViableHealthDataspacev2/openapi.yaml"
: "/openapi.yaml";
export default function ApiReferencePage() {
// Scalar's "Try it" panel would otherwise use the first server in the
// OpenAPI spec (http://localhost:3000) even when the page is served from
// ehds.mabu.red, leaving copy-pasted curl snippets pointing at the wrong
// host. Pinning baseServerURL to the actual origin makes every example
// self-consistent on whichever environment the user is viewing.
const [baseServerUrl, setBaseServerUrl] = useState<string>("");
useEffect(() => {
if (typeof window !== "undefined") {
setBaseServerUrl(window.location.origin);
}
}, []);
return (
<div className="min-h-screen flex flex-col">
<div className="px-6 py-4 border-b border-[var(--border)] bg-[var(--surface-1)]">
<Link
href="/docs/developer"
className="inline-flex items-center gap-1 text-sm text-[var(--text-secondary)] hover:text-[var(--text-primary)]"
>
<ArrowLeft size={14} /> Back to Developer Guide
</Link>
<h1 className="text-2xl font-bold mt-2">API Reference</h1>
<p className="text-sm text-[var(--text-secondary)] mt-1">
Interactive, three-column reference for all REST endpoints of the EHDS
Integration Hub. Powered by Scalar — try any endpoint directly from
the right-hand code panel.
</p>
</div>
<div className="flex-1 bg-white">
<ApiReferenceReact
configuration={{
url: SPEC_URL,
theme: "default",
layout: "modern",
hideDarkModeToggle: false,
hideClientButton: false,
...(baseServerUrl ? { baseServerURL: baseServerUrl } : {}),
defaultHttpClient: {
targetKey: "shell",
clientKey: "curl",
},
metaData: {
title: "EHDS Integration Hub API",
description:
"DSP 2025-1 · DCP v1.0 · FHIR R4 · OMOP CDM · HealthDCAT-AP",
},
}}
/>
</div>
</div>
);
}
|