Files
football-next/app/swagger/route.ts
2026-05-11 12:25:33 +03:30

75 lines
2.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const html = `<!DOCTYPE html>
<html lang="fa" dir="rtl">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Swagger UI - Football Next</title>
<link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist@5/swagger-ui.css" />
<style>
body {
margin: 0;
background: #f5f7fb;
font-family: Tahoma, sans-serif;
}
.topbar {
padding: 18px 24px;
background: linear-gradient(135deg, #0f172a, #1d4ed8);
color: #fff;
}
.topbar h1 {
margin: 0 0 6px;
font-size: 22px;
}
.topbar p {
margin: 0;
opacity: 0.9;
line-height: 1.8;
}
#swagger-ui {
max-width: 1400px;
margin: 0 auto;
}
.swagger-ui .topbar {
display: none;
}
</style>
</head>
<body>
<div class="topbar">
<h1>مستندات Swagger پروژه Football Next</h1>
<p>خروجی OpenAPI از مسیر <code>/api/openapi</code> خوانده می‌شود. اگر قبلاً در همین مرورگر لاگین کرده باشید، تست Endpointهای Session-based هم قابل انجام است.</p>
</div>
<div id="swagger-ui"></div>
<script src="https://unpkg.com/swagger-ui-dist@5/swagger-ui-bundle.js"></script>
<script src="https://unpkg.com/swagger-ui-dist@5/swagger-ui-standalone-preset.js"></script>
<script>
window.onload = function () {
window.ui = SwaggerUIBundle({
url: "/api/openapi",
dom_id: "#swagger-ui",
deepLinking: true,
presets: [SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset],
layout: "StandaloneLayout",
persistAuthorization: true,
docExpansion: "list",
defaultModelsExpandDepth: 2,
displayRequestDuration: true,
requestInterceptor: function (request) {
request.credentials = "include";
return request;
},
});
};
</script>
</body>
</html>`;
export async function GET() {
return new Response(html, {
headers: {
"Content-Type": "text/html; charset=utf-8",
"Cache-Control": "no-store",
},
});
}