Skip to content

Conversation

@mungyun
Copy link
Contributor

@mungyun mungyun commented Nov 9, 2024

💿 이슈번호

[linkbrary #29 ]

📌 구현 내용

  • 로그인과 회원가입페이지에 클라이언트에서 유효성 검사를 하도록 기능을 추가했습니다.

image

  • 회원가입페이지에 폼을 입력하고 회원가입 버튼을 누르면 서버에 POST 요청을 보내 회원가입을 할 수 있고 회원가입에 성공하면 /login 페이지로 이동합니다.
  • CORS 에러 해결을 위해 sign-up.ts파일에 따로 Proxy서버를 구축했습니다.

@mungyun mungyun self-assigned this Nov 9, 2024
Copy link
Collaborator

@hongggyelim hongggyelim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다 : >

@junjeeong
Copy link
Collaborator

cors에러는 언제 왜 나는거에요?

@junjeeong
Copy link
Collaborator

cors에러는 언제 왜 나는거에요?

cors 에러를 띄우는 주체가 브라우저인데 서버 끼리 통신하면 브라우저의 제약을 받지 않으니 에러가 안 나는 거군요!

@mungyun
Copy link
Contributor Author

mungyun commented Nov 9, 2024

cors에러는 언제 왜 나는거에요?

cors 에러를 띄우는 주체가 브라우저인데 서버 끼리 통신하면 브라우저의 제약을 받지 않으니 에러가 안 나는 거군요!

넵 맞아요! 정확히는 브라우저와 서버의 도메인을 같게해줘서 CORS를 해결하는 거에용

@junjeeong
Copy link
Collaborator

junjeeong commented Nov 9, 2024

cors에러는 언제 왜 나는거에요?

cors 에러를 띄우는 주체가 브라우저인데 서버 끼리 통신하면 브라우저의 제약을 받지 않으니 에러가 안 나는 거군요!

넵 맞아요! 정확히는 브라우저와 서버의 도메인을 같게해줘서 CORS를 해결하는 거에용

옹? proxy서버로 우회를 해서 요청을 보내도 도메인은 다르지 않나요? 클라이언트에서 바로 보내는 것과 마찬가지로 localhost -> linkbrary이니까요 하지만 직접적으로 보내는 주체는 서버이기 떄문에 브라우저 제약이 없어서 CORS 에러를 일으키지 않는 것일 뿐이고요!
(쉽게 말해 브라우저 입장에서는 에러가 나야 정상인데 단순히 우회해서 에러발생만 피하는거죠! CORS 정책에는 위반된다고 볼 수 있고요!)
(반대로 요청을 받을 때에도 바로 linkbrary-> client로 했따면 CORS가 났을텐데 서버함수가 대신 받아 클라이언트에게 주니, 서버함수와 클라이언트의 도메인은 같아서 CORS 에러를 피하는거구!)

스크린샷 2024-11-09 오후 4 24 12 스크린샷 2024-11-09 오후 4 22 17

import AuthLayout from "@/components/Layout/AuthLayout";
import Link from "next/link";

const Login = () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

페이지 컴포넌트는 접미사에 Page 붙히기로 얘기했던 것 같아요!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵! 반영할게여

@mungyun mungyun merged commit bd01a01 into develop Nov 9, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants