/users/register
http method: post
req.body {
"email" : "string",
"password": "string",
"confirmPassword": "string",
"verificationCode": "string"
}
status: 200
res.body {
{"message":"인증코드가 발송되었습니다."}
}
status: 400 // 존재하는 이메일일 때
res.body {
{ message: "이미 등록된 이메일입니다." }
}
/users/login
http method: post
req.body {
"email": "string",
"password": "string"
}
status: 200
res.body {
{ message: "로그인 성공" }
}
stauts: 401 // 사용자가 없거나 아이디 또는 비밀번호가 틀린 경우
res.body {
{ message: "유효하지않은 이메일 또는 비밀번호입니다." }
}
/users/logout
http method: post
req.body {}
status에 상관없이 쿠키 강제 만료
/protected
http method: get
req.body {}
{
"message": "사용자 데이터",
"user": {
"id": "string", // 사용자 고유 id
"email": "string",
"iat": 1728239488, // 토큰 시작 시간
"exp": 1728243088 // 토큰 만료 시간
}
}
/users/verification
http method: post
req.body {
"email": "string"
}
status: 200
res.body {
{ message: "인증코드가 발송되었습니다." }
}
status: 400 // 이미 존재하는 이메일의 경우
res.body {
{ message: "이미 등록된 이메일입니다." }
}
/users/verify
http method: post
req.body {
"email": "string",
"verificationCode": "string"
}
status: 200
res.body {
{ message: "인증코드가 확인되었습니다." }
}
status: 400 // 만료되었거나 인증코드가 틀렸을 경우
res.body {
{ message: "유효하지 않거나 만료된 인증 코드입니다." }
}
댓글