parent
bd46a48f76
commit
39ad43bbb2
@ -3,7 +3,6 @@ import express, { Application } from "express";
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { getMetadataArgsStorage } from "routing-controllers";
|
import { getMetadataArgsStorage } from "routing-controllers";
|
||||||
import { routingControllersToSpec } from "routing-controllers-openapi";
|
import { routingControllersToSpec } from "routing-controllers-openapi";
|
||||||
import * as swaggerUiExpress from "swagger-ui-express";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loader for everything openapi related - from creating the schema to serving it via a static route and swaggerUiExpress.
|
* Loader for everything openapi related - from creating the schema to serving it via a static route and swaggerUiExpress.
|
||||||
@ -47,15 +46,15 @@ export default async (app: Application) => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
//Options for swaggerUiExpress
|
// //Options for swaggerUiExpress
|
||||||
const options = {
|
// const options = {
|
||||||
explorer: true,
|
// explorer: true,
|
||||||
};
|
// };
|
||||||
app.use(
|
// app.use(
|
||||||
"/api/docs/swagger",
|
// "/api/docs/swagger",
|
||||||
swaggerUiExpress.serve,
|
// swaggerUiExpress.serve,
|
||||||
swaggerUiExpress.setup(spec, options)
|
// swaggerUiExpress.setup(spec, options)
|
||||||
);
|
// );
|
||||||
app.get(["/api/docs/openapi.json", "/api/docs/swagger.json"], (req, res) => {
|
app.get(["/api/docs/openapi.json", "/api/docs/swagger.json"], (req, res) => {
|
||||||
res.json(spec);
|
res.json(spec);
|
||||||
});
|
});
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<a href="./redoc">ReDoc</a>
|
<a href="./redoc">ReDoc</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="./swagger">SwaggerUI</a>
|
<a href="./swaggerui">SwaggerUI</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="./rapidoc">RapiDoc</a>
|
<a href="./rapidoc">RapiDoc</a>
|
||||||
|
3
src/static/docs/swagger-ui-bundle.js
Normal file
3
src/static/docs/swagger-ui-bundle.js
Normal file
File diff suppressed because one or more lines are too long
3
src/static/docs/swagger-ui-standalone-preset.js
Normal file
3
src/static/docs/swagger-ui-standalone-preset.js
Normal file
File diff suppressed because one or more lines are too long
8895
src/static/docs/swagger-ui.css
Normal file
8895
src/static/docs/swagger-ui.css
Normal file
File diff suppressed because it is too large
Load Diff
58
src/static/docs/swaggerui.html
Normal file
58
src/static/docs/swaggerui.html
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
<!-- HTML for static distribution bundle build -->
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Swagger UI</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" >
|
||||||
|
<style>
|
||||||
|
html
|
||||||
|
{
|
||||||
|
box-sizing: border-box;
|
||||||
|
overflow: -moz-scrollbars-vertical;
|
||||||
|
overflow-y: scroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
*,
|
||||||
|
*:before,
|
||||||
|
*:after
|
||||||
|
{
|
||||||
|
box-sizing: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
body
|
||||||
|
{
|
||||||
|
margin:0;
|
||||||
|
background: #fafafa;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="swagger-ui"></div>
|
||||||
|
|
||||||
|
<script src="./swagger-ui-bundle.js" charset="UTF-8"> </script>
|
||||||
|
<script src="./swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
|
||||||
|
<script>
|
||||||
|
window.onload = function() {
|
||||||
|
// Begin Swagger UI call region
|
||||||
|
const ui = SwaggerUIBundle({
|
||||||
|
url: "/api/docs/openapi.json",
|
||||||
|
dom_id: '#swagger-ui',
|
||||||
|
deepLinking: true,
|
||||||
|
presets: [
|
||||||
|
SwaggerUIBundle.presets.apis,
|
||||||
|
SwaggerUIStandalonePreset
|
||||||
|
],
|
||||||
|
plugins: [
|
||||||
|
SwaggerUIBundle.plugins.DownloadUrl
|
||||||
|
],
|
||||||
|
layout: "StandaloneLayout"
|
||||||
|
})
|
||||||
|
// End Swagger UI call region
|
||||||
|
|
||||||
|
window.ui = ui
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
x
Reference in New Issue
Block a user