Compare commits

..

No commits in common. "bd46a48f76d370f150d981c1ccc81ae08290bbfe" and "5c3c3eb167cbfdfe38467f5ec58b42aa16e9876a" have entirely different histories.

4 changed files with 5 additions and 30 deletions

2
.gitignore vendored
View File

@ -132,5 +132,5 @@ build
*.sqlite
*.sqlite-jurnal
/docs
docs
lib

View File

@ -1,6 +1,5 @@
import { validationMetadatasToSchemas } from "class-validator-jsonschema";
import express, { Application } from "express";
import path from 'path';
import { Application } from "express";
import { getMetadataArgsStorage } from "routing-controllers";
import { routingControllersToSpec } from "routing-controllers-openapi";
import * as swaggerUiExpress from "swagger-ui-express";
@ -52,13 +51,12 @@ export default async (app: Application) => {
explorer: true,
};
app.use(
"/api/docs/swagger",
"/api/docs",
swaggerUiExpress.serve,
swaggerUiExpress.setup(spec, options)
);
app.get(["/api/docs/openapi.json", "/api/docs/swagger.json"], (req, res) => {
app.get(["/api/openapi.json", "/api/swagger.json"], (req, res) => {
res.json(spec);
});
app.use('/api/docs', express.static(path.join(__dirname, '../static/docs'), { index: "index.html", extensions: ['html'] }));
return app;
};

View File

@ -36,14 +36,7 @@ const spec = routingControllersToSpec(
"AuthToken": {
"type": "http",
"scheme": "bearer",
"bearerFormat": "JWT",
description: "A JWT based access token. Use /api/auth/login or /api/auth/refresh to get one."
},
"RefreshTokenCookie": {
"type": "apiKey",
"in": "cookie",
"name": "lfk_backend__refresh_token",
description: "A cookie containing a JWT based refreh token. Attention: Doesn't work in swagger-ui. Use /api/auth/login or /api/auth/refresh to get one."
"bearerFormat": "JWT"
}
}
},

View File

@ -1,16 +0,0 @@
<!DOCTYPE html>
<h1>Pick your poison</h1>
<ul>
<li>
<a href="./redoc">ReDoc</a>
</li>
<li>
<a href="./swagger">SwaggerUI</a>
</li>
<li>
<a href="./rapidoc">RapiDoc</a>
</li>
<li>
<a href="./openapi.json">Raw Spec (json)</a>
</li>
</ul>