Skip to content

POST 요청시 req.body에서 데이터를 받아올 수 없는 문제 #10

@DreamBoysYJ

Description

@DreamBoysYJ

image

현재 server/app.ts에서 라우팅 미들웨어가 다른 미들웨어보다 위에 작성되어 있어서,
post 컨트롤러에서 req.body 안에서 json 형식의 데이터를 받지 못하는 에러가 발생했습니다.
위 캡쳐처럼 미들웨어들의 마지막에 라우팅 미들웨어로 설정해줘야 합니다.

만약 라우팅 미들웨어를 위에 놓고 post 요청을 받는다면
req 내부에 body가 아예 없는 버그가 발생합니다.
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    errorerror handling

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions