-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feat] MSW 세팅 #239
[Feat] MSW 세팅 #239
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -0,0 +1,23 @@ | |||
'use client'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use client가 추가 되었는데도 ssr에서 동작한다는게 참으로 신기하고만용
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use client가 추가 되었는데도 ssr에서 동작한다는게 참으로 신기하고만용
이거 붙어서 안되지 않을까요.. 되면 진짜 신기할것 같아요 👀
제가 했던건 msw1이라 리뷰 불가능 이슈 ㅜㅜ
|
응답에 대한 인터페이스 정의가 어떤식일까요? |
위 부분에서 응답의 형태가 인터페이스로 정의되어 있고 이를 훅이나 서비스에서도 활용하는 것을 의미했었어요! |
제가 맞게 이해했다면 서버에서 받아오는 타입을 정의 하는 것으로 이해했습니다. /msw 파일에서 서버리스폰스의 인터페이스를 정의하는 건 좀 어색하다고 생각하는데 어떻게 생각하시나요? 따로 types 파일이나 apis에서 정의해보면 좋을 것 같아요 |
🤔 해결하려는 문제가 무엇인가요?
🎉 변경 사항
🙏 여기는 꼭 봐주세요!
mocking 에 대한 파일들은 /msw 에 있습니다.
도메인마다 각각 다른 파일에서 handler 정의
SSR 시점에서도 모킹된 데이터를 받아오는 것 확인했습니다만, app router + msw 는 처음 사용해봐서 사용하다가 이슈가 생길수도 있을 것 같아요.
다.
사용 방법
src/msw/handlers/mission.ts 의 핸들러 정의 법을 참고하시거나 공식문서에 나오는 예시 코드를 참고하시면 mock api 만들기 수월하실 겁니다!
🌄 스크린샷
📚 참고
msw getting started
https://mswjs.io/docs/getting-started
msw nextjs 13 지원 이슈
mswjs/msw#1644
app router 13 msw example
https://github.com/mswjs/examples-new/pull/7/files#diff-36f843d6f46ae2284e5767c3ed46cdadb2d5a296e3a4016e7ad7d1460c03ab2d
instrumentation 에 대한 설명
https://nextjs.org/docs/app/building-your-application/optimizing/instrumentation