Created
October 15, 2022 07:12
-
-
Save gchacaltana/b35495f9387d994d37209ef588170150 to your computer and use it in GitHub Desktop.
Template Swagger UI for API documentation [OpenAPI v3.0]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>API Docs with Swagger UI</title> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist@3/swagger-ui.css"> | |
</head> | |
<body> | |
<div id="swagger-ui"></div> | |
<script src="https://unpkg.com/swagger-ui-dist@3/swagger-ui-bundle.js"></script> | |
<script> | |
const ui = SwaggerUIBundle({ | |
url: "{% url 'schema' %}", | |
dom_id: '#swagger-ui', | |
presets: [ | |
SwaggerUIBundle.presets.apis, | |
SwaggerUIBundle.SwaggerUIStandalonePreset | |
], | |
layout: "BaseLayout", | |
requestInterceptor: (request) => { | |
request.headers['X-CSRFToken'] = "{{ csrf_token }}" | |
return request; | |
} | |
}) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment