Co-authored-by: Patrick Mueller <patrick@mueller-patrick.tech> Reviewed-on: #17 Co-authored-by: Patrick Müller <patrick@plutodev.de> Co-committed-by: Patrick Müller <patrick@plutodev.de>
This commit was merged in pull request #17.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import express from 'express';
|
||||
import * as http from 'http';
|
||||
import * as dotenv from 'dotenv';
|
||||
import swaggerUi from 'swagger-ui-express';
|
||||
import swaggerJSDoc from 'swagger-jsdoc';
|
||||
// Router imports
|
||||
import {partyPlanerRouter} from './src/models/partyplaner/PartyPlaner.router';
|
||||
import {highlightMarkerRouter} from './src/models/twitch-highlight-marker/HighlightMarker.router';
|
||||
@@ -31,6 +33,39 @@ app.use(express.json());
|
||||
// Use CORS
|
||||
app.use(cors());
|
||||
|
||||
// Swagger documentation
|
||||
const swaggerDefinition = {
|
||||
openapi: '3.0.0',
|
||||
info: {
|
||||
title: 'Pluto Development REST API',
|
||||
version: '2.0.0',
|
||||
license: {
|
||||
name: 'Licensed Under MIT',
|
||||
url: 'https://spdx.org/licenses/MIT.html'
|
||||
},
|
||||
contact: {
|
||||
name: 'Pluto Development',
|
||||
url: 'https://www.pluto-development.de'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const options = {
|
||||
swaggerDefinition,
|
||||
// Paths to files containing OpenAPI definitions
|
||||
apis: [
|
||||
'./src/models/**/*.router.ts'
|
||||
]
|
||||
};
|
||||
|
||||
const swaggerSpec = swaggerJSDoc(options);
|
||||
|
||||
app.use(
|
||||
'/docs',
|
||||
swaggerUi.serve,
|
||||
swaggerUi.setup(swaggerSpec)
|
||||
);
|
||||
|
||||
// Add routers
|
||||
app.use('/dhbw-service', dhbwServiceRouter);
|
||||
app.use('/twitch-highlight-marker', highlightMarkerRouter);
|
||||
|
||||
Reference in New Issue
Block a user