Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#426 [Bug] Swagger api 테스트가 작동하지 않음 #427

Merged
merged 11 commits into from
Nov 7, 2023
23 changes: 23 additions & 0 deletions src/routes/docs/swaggerDocs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,28 @@ const reportsDocs = require("./reports");
const logininfoDocs = require("./logininfo");
const locationsDocs = require("./locations");
const usersDocs = require("./users");
const { port, nodeEnv } = require("../../../loadenv");

const serverList = [
{
url: `http://localhost:${port}`,
description: "local api server",
development: true,
production: false,
},
{
url: "https://taxi.sparcs.org/api",
description: "taxi main api server",
development: true,
production: true,
},
{
url: "https://taxi.dev.sparcs.org/api",
description: "taxi dev api server",
development: true,
production: false,
},
];
Comment on lines +8 to +27
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loadEnv.js에서 servers 필드의 값을 직접 계산하는 방법도 괜찮다고 생각해요!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@withSang 저 serverList를 아예 loadEnv.js에서 정의하자는 말씀이시죠? 다른 코드에서 servers 값을 재사용 할 일이 있으면 그게 나을 것 같은데 어떤 경우일까요??


const swaggerDocs = {
openapi: "3.0.3",
Expand All @@ -11,6 +33,7 @@ const swaggerDocs = {
version: "1.0.0",
},
basePath: "/",
servers: serverList.filter((server) => server[nodeEnv]),
tags: [
{
name: "locations",
Expand Down