@@ -1,5 +1,6 @@
|
||||
import { validationMetadatasToSchemas } from "class-validator-jsonschema";
|
||||
import { Application } from "express";
|
||||
import express, { Application } from "express";
|
||||
import path from 'path';
|
||||
import { getMetadataArgsStorage } from "routing-controllers";
|
||||
import { routingControllersToSpec } from "routing-controllers-openapi";
|
||||
import * as swaggerUiExpress from "swagger-ui-express";
|
||||
@@ -51,12 +52,13 @@ export default async (app: Application) => {
|
||||
explorer: true,
|
||||
};
|
||||
app.use(
|
||||
"/api/docs",
|
||||
"/api/docs/swagger",
|
||||
swaggerUiExpress.serve,
|
||||
swaggerUiExpress.setup(spec, options)
|
||||
);
|
||||
app.get(["/api/openapi.json", "/api/swagger.json"], (req, res) => {
|
||||
app.get(["/api/docs/openapi.json", "/api/docs/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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user