fix(backend): Verloren Swagger setup

This commit is contained in:
Tibo De Peuter 2025-03-13 21:46:41 +01:00
parent 5986ca57bf
commit 55ec9ca02e
Signed by: tdpeuter
GPG key ID: 38297DE43F75FFE2
3 changed files with 8 additions and 9 deletions

View file

@ -7,6 +7,8 @@ import { responseTimeLogger } from './logging/responseTimeLogger.js';
import responseTime from 'response-time';
import { EnvVars, getNumericEnvVar } from './util/envvars.js';
import apiRouter from './routes/router.js';
import swaggerMiddleware from './swagger';
import swaggerUi from 'swagger-ui-express';
const logger: Logger = getLogger();
@ -19,8 +21,11 @@ app.use(authenticateUser);
// Add response time logging
app.use(responseTime(responseTimeLogger));
// Swagger
app.get('/api', apiRouter);
app.use('/api-docs', swaggerUi.serve, swaggerMiddleware);
async function startServer() {
await initORM();

View file

@ -1,10 +1,6 @@
import express from 'express';
import { getFrontendAuthConfig } from '../controllers/auth.js';
import {
authenticatedOnly,
studentsOnly,
teachersOnly,
} from '../middleware/auth/auth.js';
import { authenticatedOnly, studentsOnly, teachersOnly } from '../middleware/auth/auth.js';
const router = express.Router();
// Returns auth configuration for frontend

View file

@ -26,8 +26,7 @@ const doc = {
type: 'oauth2',
flows: {
implicit: {
authorizationUrl:
'http://localhost:7080/realms/student/protocol/openid-connect/auth',
authorizationUrl: 'http://localhost:7080/realms/student/protocol/openid-connect/auth',
scopes: {
openid: 'openid',
profile: 'profile',
@ -40,8 +39,7 @@ const doc = {
type: 'oauth2',
flows: {
implicit: {
authorizationUrl:
'http://localhost:7080/realms/teacher/protocol/openid-connect/auth',
authorizationUrl: 'http://localhost:7080/realms/teacher/protocol/openid-connect/auth',
scopes: {
openid: 'openid',
profile: 'profile',