API-35: First steps in swagger integration

This commit is contained in:
2022-01-08 15:06:39 +01:00
parent 5257797866
commit ec533394ce
6 changed files with 3605 additions and 55 deletions
+6
View File
@@ -2,3 +2,9 @@
.idea
**/*.iml
.env
# Build output
dist/
logs/
node_modules/
public/
+12
View File
@@ -1,6 +1,7 @@
import express from 'express';
import * as http from 'http';
import * as dotenv from 'dotenv';
import swaggerUi from 'swagger-ui-express';
// Router imports
import {partyPlanerRouter} from './src/models/partyplaner/PartyPlaner.router';
import {highlightMarkerRouter} from './src/models/twitch-highlight-marker/HighlightMarker.router';
@@ -30,6 +31,17 @@ app.use(express.json());
// Use CORS
app.use(cors());
// Swagger documentation
app.use(
'/docs',
swaggerUi.serve,
swaggerUi.setup(undefined, {
swaggerOptions: {
url: '/public/swagger.json'
}
})
);
// Add routers
app.use('/dhbw-service', dhbwServiceRouter);
app.use('/twitch-highlight-marker', highlightMarkerRouter);
+3538 -20
View File
File diff suppressed because it is too large Load Diff
+6 -2
View File
@@ -1,5 +1,5 @@
{
"name": "PlutoDevExpressAPI",
"name": "plutodev_express_api",
"version": "1.0.0",
"description": "",
"main": "index.js",
@@ -7,7 +7,8 @@
"start": "tsc && node ./dist/app.js",
"build": "tsc",
"debug": "export DEBUG=* && npm run start",
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"swagger": "tsoa spec"
},
"keywords": [],
"author": "",
@@ -21,6 +22,8 @@
"express": "^4.17.1",
"guid-typescript": "^1.0.9",
"mariadb": "^2.5.3",
"swagger-ui-express": "^4.3.0",
"tsoa": "^3.14.1",
"winston": "^3.3.3"
},
"devDependencies": {
@@ -28,6 +31,7 @@
"@types/bcrypt": "^3.0.1",
"@types/debug": "^4.1.5",
"@types/express": "^4.17.11",
"@types/swagger-ui-express": "^4.1.3",
"@types/winston": "^2.4.4",
"source-map-support": "^0.5.19",
"tslint": "^6.1.3",
+3 -1
View File
@@ -5,6 +5,8 @@
"outDir": "./dist",
"strict": true,
"esModuleInterop": true,
"inlineSourceMap": true
"inlineSourceMap": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true
}
}
+8
View File
@@ -0,0 +1,8 @@
{
"entryFile": "app.ts",
"noImplicitAdditionalProperties": "throw-on-extras",
"spec": {
"outputDirectory": "public",
"specVersion": 3
}
}