@@ -35,6 +35,8 @@
 | 
			
		||||
        "pg": "^8.5.1",
 | 
			
		||||
        "reflect-metadata": "^0.1.13",
 | 
			
		||||
        "routing-controllers": "^0.9.0-alpha.6",
 | 
			
		||||
        "routing-controllers-openapi": "^2.1.0",
 | 
			
		||||
        "swagger-ui-express": "^4.1.5",
 | 
			
		||||
        "typeorm": "^0.2.29"
 | 
			
		||||
    },
 | 
			
		||||
    "devDependencies": {
 | 
			
		||||
@@ -42,8 +44,9 @@
 | 
			
		||||
        "@types/dotenv-safe": "^8.1.1",
 | 
			
		||||
        "@types/express": "^4.17.9",
 | 
			
		||||
        "@types/jsonwebtoken": "^8.5.0",
 | 
			
		||||
		"@types/node": "^14.14.9",
 | 
			
		||||
		"@types/multer": "^1.4.4",
 | 
			
		||||
        "@types/node": "^14.14.9",
 | 
			
		||||
        "@types/multer": "^1.4.4",
 | 
			
		||||
        "@types/swagger-ui-express": "^4.1.2",
 | 
			
		||||
        "dotenv-safe": "^8.2.0",
 | 
			
		||||
        "husky": "^4.3.0",
 | 
			
		||||
        "nodemon": "^2.0.6",
 | 
			
		||||
 
 | 
			
		||||
@@ -1,11 +1,11 @@
 | 
			
		||||
import expressLoader from "./express";
 | 
			
		||||
import routeLoader from "./routes";
 | 
			
		||||
import openapiLoader from "./openapi";
 | 
			
		||||
import databaseLoader from "./database";
 | 
			
		||||
import {Application} from "express";
 | 
			
		||||
import { Application } from "express";
 | 
			
		||||
 | 
			
		||||
export default async (app: Application) => {
 | 
			
		||||
    await databaseLoader();
 | 
			
		||||
    await openapiLoader(app);
 | 
			
		||||
    await expressLoader(app);
 | 
			
		||||
    await routeLoader(app);
 | 
			
		||||
    return app;
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										11
									
								
								src/loaders/openapi.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								src/loaders/openapi.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
import { Application } from "express";
 | 
			
		||||
import * as swaggerUiExpress from "swagger-ui-express";
 | 
			
		||||
import { getMetadataArgsStorage } from "routing-controllers";
 | 
			
		||||
import { routingControllersToSpec } from "routing-controllers-openapi";
 | 
			
		||||
 | 
			
		||||
export default async (app: Application) => {
 | 
			
		||||
    const storage = getMetadataArgsStorage();
 | 
			
		||||
    const spec = routingControllersToSpec(storage);
 | 
			
		||||
    app.use("/docs", swaggerUiExpress.serve, swaggerUiExpress.setup(spec));
 | 
			
		||||
    return app;
 | 
			
		||||
};
 | 
			
		||||
@@ -1,7 +0,0 @@
 | 
			
		||||
import {Application} from "express";
 | 
			
		||||
import routerMain from "../routes/index";
 | 
			
		||||
 | 
			
		||||
export default async (app: Application) => {
 | 
			
		||||
	app.use('/api/', routerMain);
 | 
			
		||||
	return app;
 | 
			
		||||
};
 | 
			
		||||
		Reference in New Issue
	
	Block a user