fix(backend): Verloren Swagger setup
This commit is contained in:
parent
5986ca57bf
commit
55ec9ca02e
3 changed files with 8 additions and 9 deletions
|
@ -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();
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue