Swagger 사용 관련 질문이 있습니다.
미해결
[리뉴얼] React로 NodeBird SNS 만들기
안녕하세요 제로초님! 제가 swagger를 이용해서 api들을 정리 및 테스트를 해볼려고 하는데 잘 되지가 않아서 질문드립니다. /** * @swagger * /user: * get: * tags: * description: 유저 데이터 조회 및 유저의 Post, Following, Follower 조회 * produces: * - application/json * parameters: * - in: user * name: id * description: 반드시 로그인이 되있는 상태에서 call 해야 user data 조회 가능 * schema: * type: object * properties: * name: * type: number * responses: * 200: * description: 유저 조회 성공 / 또는 조회 실패(null) */ router . get ( "/" , async ( req , res , next ) => { // GET /user try { if ( req . user ) { const fullUserWithoutPassword = await User . findOne ({ where : { id : req . user . id }, attributes : { exclude : [ "password" ], }, include : [ { model : Post , attributes : [ "id" ], }, { model : User , as : "Followings" , attributes : [ "id" ], }, { model : User , as : "Followers" , attributes : [ "id" ], }, ], }); res . status ( 200 ). json ( fullUserWithoutPassword ); } else { res . status ( 200 ). json ( null ); } } catch ( error ) { console . error ( error ); next ( error ); } }); 제가 get.axios("/user")를 swagger로 정리 및 테스트 할려고 하는데 계속 respond로 null이 뜹니다. 아무래도 제가 swagger 코드를 잘못친거 같은데 이 여기에서는 어떻게 swagger를 작성해야 될까요?
- swagger
- express
- nodejs
- react
- redux
- Next.js





