Cleaned up openapi stuff
This commit is contained in:
parent
c2d714116e
commit
4efb62921b
@ -1,6 +1,5 @@
|
|||||||
import { validationMetadatasToSchemas } from "@odit/class-validator-jsonschema";
|
import { validationMetadatasToSchemas } from "@odit/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 { generateSpec } from '../apispec';
|
import { generateSpec } from '../apispec';
|
||||||
|
|
||||||
@ -16,9 +15,9 @@ export default async (app: Application) => {
|
|||||||
|
|
||||||
//Spec creation based on the previously created schemas
|
//Spec creation based on the previously created schemas
|
||||||
const spec = generateSpec(storage, 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);
|
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;
|
return app;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user