This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects
index.html 2 KiB
Newer Older
Lukas Kaltenbrunner's avatar
Lukas Kaltenbrunner committed
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>gitsearch - Swagger UI</title>
Lukas Kaltenbrunner's avatar
Lukas Kaltenbrunner committed
    <link rel="stylesheet" type="text/css" href="./swagger-ui.css">
    <link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32"/>
    <link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16"/>
</head>

<body>
<div id="swagger-ui"></div>
Lukas Kaltenbrunner's avatar
Lukas Kaltenbrunner committed

<script src="./swagger-ui-bundle.js"></script>
<script src="./swagger-ui-standalone-preset.js"></script>
<script src="./axios.min.js"></script>


<script type="text/javascript">
    window.onload = function () {


Michael Breu's avatar
Michael Breu committed
        var urls = [];
Lukas Kaltenbrunner's avatar
Lukas Kaltenbrunner committed
        axios.get("/swagger-resources").then(function (response) {
            response.data.forEach(function (resource) {
                urls.push({"name": resource.name, "url": resource.location});
            });

            urls.sort(function (a, b) {
                var x = a.name.toLowerCase(), y = b.name.toLowerCase();
                return x < y ? -1 : x > y ? 1 : 0;
            });

            // Build a system
            var ui = SwaggerUIBundle({
                urls: urls,
                dom_id: '#swagger-ui',
                deepLinking: true,
                filter: true,
                layout: "StandaloneLayout",
                withCredentials: true,
                presets: [
                    SwaggerUIBundle.presets.apis,
                    SwaggerUIStandalonePreset
                ],
                plugins: [
                    SwaggerUIBundle.plugins.DownloadUrl
                ],
                requestInterceptor: function (req) {
                    var authToken = JSON.parse(localStorage.getItem("jhi-authenticationtoken")
                        || sessionStorage.getItem("jhi-authenticationtoken"));
                    if (authToken) {
                        req.headers['Authorization'] = "Bearer " + authToken;
                    }
                    return req;
                }
            });

            window.ui = ui
        });

    };
</script>
</body>
</html>