Skip to content
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

게시글 조회 #4

Open
seoyeon0201 opened this issue Jun 5, 2024 · 0 comments
Open

게시글 조회 #4

seoyeon0201 opened this issue Jun 5, 2024 · 0 comments
Assignees
Labels

Comments

@seoyeon0201
Copy link
Contributor

seoyeon0201 commented Jun 5, 2024

1. postId로 조회
http://localhost:8080/v1/post?postId=1

{
    "status": "OK",
    "message": "Post Get",
    "data": {
        "title": "Title12 hi",
        "contents": "contents1",
        "tagNames": [
            "tag1",
            "tag2",
            "tag3"
        ]
    }
}

2. URL로 조회
http://localhost:8080/MyBlog.io/@[USERID]/[SLUG]

  • 추후 userId를 닉네임으로 변경
  • slug는 현재 title을 단순히 정해진 형태로 변형한 것
    • 추후에 slug를 title과 contents의 요약 형식으로 변경
{
    "status": "OK",
    "message": "Post Get",
    "data": {
        "title": "Title12 hi",
        "contents": "contents1",
        "tagNames": [
            "tag1",
            "tag2",
            "tag3"
        ]
    }
}
image

🚨 TroubleShooting

순환 참조
Post 가져올 때 Post와 PostHashtag 간의 순환 참조 문제 발생

해결
@OneToMany에는 @JsonManagedReference, @ManyToOne에는 @JsonBackReference annotation 추가

@seoyeon0201 seoyeon0201 added bug Something isn't working feat and removed bug Something isn't working labels Jun 5, 2024
@seoyeon0201 seoyeon0201 self-assigned this Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant