인프런 커뮤니티 질문&답변
강의 잘듣고 있습니다.
작성
·
198
0
강의에서 배운 내용에 스웨거를 적용하고 있는데 해결되지 않는 문제가 있어 질문드립니다.
스웨거 세팅은 다 끝내서 잘 사용하고 있다가 로그인 쪽에 POST 요청 시 req.body의 내용이 없어 질문드니다.
로그인 부분을 스웨거로 테스트 하려고 하는데 Parameter값이 넘어오지 않습니다. 이유가 무엇일까요....?
PostMan으로 했을때는 잘 넘어 옵니다.
/**
* @swagger
* /user/login:
* post:
* summary: Creates a new message.
* consumes:
* - application/json
* tags:
* - Create a new message
* parameters:
* - in: body
* name: user
* description: The user to create.
* schema:
* type: object
* required:
* - name
* - email
* - text
* properties:
* name:
* type: string
* email:
* type: string
* text:
* type: string
* responses:
* 201:
* description: New message created!
*/
router.post('/login', (req, res, next) => {
// Generate ID
//req.body.id = Math.floor(Math.random() * 100) * 1
console.log(req.body);
console.log(req.user);
res.json(req.body);
});




