API-35: First steps in swagger integration

This commit is contained in:
Patrick Müller 2022-01-08 15:06:39 +01:00
parent 5257797866
commit ec533394ce
Signed by: Paddy
GPG Key ID: 37ABC11275CAABCE
6 changed files with 3605 additions and 55 deletions

6
.gitignore vendored
View File

@ -2,3 +2,9 @@
.idea
**/*.iml
.env
# Build output
dist/
logs/
node_modules/
public/

12
app.ts
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);

3558
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,36 +1,40 @@
{
"name": "PlutoDevExpressAPI",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "tsc && node ./dist/app.js",
"build": "tsc",
"debug": "export DEBUG=* && npm run start",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"app-root-path": "^3.0.0",
"bcrypt": "^5.0.1",
"cors": "^2.8.5",
"debug": "^4.3.1",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"guid-typescript": "^1.0.9",
"mariadb": "^2.5.3",
"winston": "^3.3.3"
},
"devDependencies": {
"@types/app-root-path": "^1.2.4",
"@types/bcrypt": "^3.0.1",
"@types/debug": "^4.1.5",
"@types/express": "^4.17.11",
"@types/winston": "^2.4.4",
"source-map-support": "^0.5.19",
"tslint": "^6.1.3",
"typescript": "^4.1.5"
}
"name": "plutodev_express_api",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "tsc && node ./dist/app.js",
"build": "tsc",
"debug": "export DEBUG=* && npm run start",
"test": "echo \"Error: no test specified\" && exit 1",
"swagger": "tsoa spec"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"app-root-path": "^3.0.0",
"bcrypt": "^5.0.1",
"cors": "^2.8.5",
"debug": "^4.3.1",
"dotenv": "^8.2.0",
"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": {
"@types/app-root-path": "^1.2.4",
"@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",
"typescript": "^4.1.5"
}
}

View File

@ -5,6 +5,8 @@
"outDir": "./dist",
"strict": true,
"esModuleInterop": true,
"inlineSourceMap": true
"inlineSourceMap": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true
}
}

View File

@ -0,0 +1,8 @@
{
"entryFile": "app.ts",
"noImplicitAdditionalProperties": "throw-on-extras",
"spec": {
"outputDirectory": "public",
"specVersion": 3
}
}