Skip to content
This repository was archived by the owner on Dec 6, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletions src/core/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ import httpLogger from '#core/httpLogger';
import { errorHandler } from '#middlewares/errorHandler';
import ApiError from '#errors/ApiError';

import authMiddleware from '#core/middlewares/authMiddleware';
import requireRole from '#core/middlewares/requireRole';

const app: Application = express();

/**
Expand Down Expand Up @@ -176,14 +179,27 @@ app.use(API_PREFIX, routes);
/**
* Swagger
*/
app.use(
`${API_PREFIX}/docs`,
swaggerUi.serve,
swaggerUi.setup(swaggerDoc, {
explorer: true,
customSiteTitle: 'WeLive API Docs',
})
);
if (env.NODE_ENV === 'production') {
app.use(
`${API_PREFIX}/docs`,
authMiddleware,
requireRole(['SUPER_ADMIN']),
swaggerUi.serve,
swaggerUi.setup(swaggerDoc, {
explorer: true,
customSiteTitle: 'WeLive API Docs',
})
);
} else {
app.use(
`${API_PREFIX}/docs`,
swaggerUi.serve,
swaggerUi.setup(swaggerDoc, {
explorer: true,
customSiteTitle: 'WeLive API Docs',
})
);
}

/**
* 404 핸들러
Expand Down