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
*.sqlite-jurnal *.sqlite-jurnal
/docs docs
lib lib

View File

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

View File

@ -36,14 +36,7 @@ const spec = routingControllersToSpec(
"AuthToken": { "AuthToken": {
"type": "http", "type": "http",
"scheme": "bearer", "scheme": "bearer",
"bearerFormat": "JWT", "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."
} }
} }
}, },

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>