feat(api): Add Swagger UI for v1 endpoints
Serve interactive docs at /api, covering only the current /api/v1/* endpoints. Deprecated /api/diyanet/* endpoints are left undocumented.
This commit is contained in:
1 parent
c3bf3eca8d
commit
cec7f1566e
3 files changed
+193
No files matched your search
@@ -0,0 +1,27 @@
|
||||
package api
|
||||
|
||||
import _ "embed"
|
||||
|
||||
//go:embed openapi.yaml
|
||||
var openapiSpec []byte
|
||||
|
||||
const swaggerHTML = `<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Prayer Times API</title>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swagger-ui-dist@5.33.1/swagger-ui.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="swagger-ui"></div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/swagger-ui-dist@5.33.1/swagger-ui-bundle.js"></script>
|
||||
<script>
|
||||
window.onload = () => {
|
||||
SwaggerUIBundle({
|
||||
url: "/api/openapi.yaml",
|
||||
dom_id: "#swagger-ui",
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>`
|
||||
Reference in new issue
Block a user