-
Notifications
You must be signed in to change notification settings - Fork 0
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
CM-171: ๐ฆ ๋ฐฑ์๋ ํ๊ฒฝ ์ค์ (DB, swagger) #6
Conversation
- api/test ๋ฅผ ํตํด DB์ฐ๊ฒฐ์ ํ ์คํธ ๊ฐ๋ฅ
- reviewer์ ๋ด๊ฐ ๋น ์ ธ์์์
- config์ ๋๋ db.ts๋ฅผ ๊ตณ์ด config์ ๋ ํ์ ์๋ค๊ณ ํ๋จํจ
- swagger-ui-react, @types/swagger-ui-react, next-swagger-doc
- db.ts๊ฐ utils๋ก ์ด๋ํ๋ฉด์ import ๋ถ๋ถ ๋ณํ - route.tsx์์ route.ts๋ก ๋ณ๊ฒฝ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์์ ๋ชจ๋ฅด์ง๋ง ๋๋ถ์ rds๊ฐ ๋ฌด์์ธ์ง ์ฐพ์๋ดค๋ค์.. ๊ณ ์ํ์ จ์ต๋๋ค!
'use client'; | ||
|
||
import SwaggerUI from 'swagger-ui-react'; | ||
import 'swagger-ui-react/swagger-ui.css'; | ||
|
||
type Props = { | ||
spec: Record<string, any>, | ||
}; | ||
|
||
function ReactSwagger({ spec }: Props) { | ||
return <SwaggerUI spec={spec} />; | ||
} | ||
|
||
export default ReactSwagger; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redoc์ด Swagger์ ๋นํด UI๊ฐ ๊ด์ฐฎ๋ค๊ณ ํ๋๋ฐ ๊ธฐ์ ์ ์ผ๋ก ๊ณต๋ถํด ๋ณผ ๊ฐ์น๊ฐ ์๋ค๋ฉด ์๊ฑธ๋ก ํจ ๋ฐ๊ฟ๋ณด๋ ๋ฐฉ๋ฒ๋ ์์ ๊ฒ ๊ฐ์ผ๋ค์..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ํ๋ฒ ํด๋ณด๋๋ก ํ๊ฒ ์ต๋๋ค!
@@ -0,0 +1,38 @@ | |||
import { createPool } from "mysql2"; | |||
import type { Pool } from "mysql2"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import ๋ฐ์ผ๋ก ํ ์ค ๋์์ฃผ๋๊ฑฐ ์ด๋ ์
|
||
export const getApiDocs = async () => { | ||
const spec = createSwaggerSpec({ | ||
apiFolder: "app/api", // define api folder under app folder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ด์ง ์งํผํฐ ํฅ๊ธฐ๊ฐ ๋๋๋ฐ ์ฃผ์์ ํ๊ธ๋ก ํต์ผํ๋ ๊ฑด ์ด๋์
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
next-swagger-doc์ ๋ฌธ์๋ฅผ ๋ฐ๋ผํ๊ฑฐ๋ผ์,, ์ฃผ์์ด ๋ฌ๋ ค์์์ด์. ์ ๊ฑฐํ๋๋ก ํ๊ฒ ์ต๋๋ค.
๐๏ธ ์์ ์์ธ ๋ด์ฉ
๐ ์์ฒญ ๋ฐ ์ง๋ฌธ์ฌํญ
์ค์ ์คํ์๋ ์ง์ฅ์ด ์๊ณ ๊ฐ๋ฐ ํ๊ฒฝ์์๋ง ๋ฐ์ํ๋ ์ค๋ฅ๊ฐ ์์ต๋๋ค..
React Strict Mode๋ ๊ฐ๋ฐ ํ๊ฒฝ์์ ์ ์ฌ์ ์ธ ๋ฌธ์ ๋ฅผ ๋ฐ๊ฒฌํ๊ฒ ๋์์ฃผ๋๊ฑด๋ฐ ์ ๊ฐ ์ฌ์ฉํ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ์ด๊ฒ๊ณผ ์ถฉ๋ํด์ ์์ ์ค๋ฅ๊ฐ ์์ต๋๋ค.
swagger-api/swagger-ui#10212
์ ํฌ์ ๋๊ฐ์ ์ํฉ๊ณผ ๋ฒ์ ์ธ ๋ถ์ด ์ด์ ์ฌ๋ ธ๋๋ฐ ์์ง ํด๊ฒฐ๋์ง๋..! ์์ ๋ฏ ํฉ๋๋ค..
ํด๊ฒฐ ๋ฐฉ๋ฒ์ 2๊ฐ์ง๊ฐ ์์ต๋๋ค..
๐ท ์คํฌ๋ฆฐ์ท
swagger ๊ฒฐ๊ณผ
db ์ฐ๋ ๊ฒฐ๊ณผ