Cleaned up openapi stuff

This commit is contained in:
Nicolai Ort 2021-01-30 17:47:22 +01:00
parent c2d714116e
commit 4efb62921b
1 changed files with 3 additions and 4 deletions

View File

@ -1,6 +1,5 @@
import { validationMetadatasToSchemas } from "@odit/class-validator-jsonschema";
import express, { Application } from "express";
import path from 'path';
import { Application } from "express";
import { getMetadataArgsStorage } from "routing-controllers";
import { generateSpec } from '../apispec';
@ -16,9 +15,9 @@ export default async (app: Application) => {
//Spec creation based on the previously created schemas
const spec = generateSpec(storage, schemas);
app.get(["/api/docs/openapi.json", "/api/docs/swagger.json"], (req, res) => {
app.get(["/docs/openapi.json", "/docs/swagger.json"], (req, res) => {
res.json(spec);
});
app.use('/api/docs', express.static(path.join(__dirname, '../static/docs'), { index: "index.html", extensions: ['html'] }));
//app.use('/api/docs', express.static(path.join(__dirname, '../static/docs'), { index: "index.html", extensions: ['html'] }));
return app;
};