API 명세서

서비스 : 회원가입 및 로그인 ( 화면 생략, Postman으로 확인)

기능 Method URL Request Response
가입 POST /api/user/signup
{
    "username" : "test",
    "password" : "testtest!"
}
{
    "status": 200,
    "message": "OK"
}
로그인 POST /api/user/login
{
    "username" : "test",
    "password" : "testtest!"
}
Header : 
Authorization : Bearer <JWT>

Body :
{
    "status": 200,
    "message": "OK"
}

 

서비스 : 메모  

기능 Method URL Request Response
모든
게시글

조회
GET /api/memos -
{
    "status": 200,
    "message": "OK",
    "data": [
        {
            "id": 7,
            "title": "제목",
            "username": "test",
            "content": "내용",
            "createdAt": "2022-12-08T13:10:11.10534",
            "modifiedAt": "2022-12-08T13:10:11.10534",
            "replies": []
        },
        {
            "id": 6,
            "title": "제목",
            "username": "test",
            "content": "내용",
            "createdAt": "2022-12-08T13:10:09.808928",
            "modifiedAt": "2022-12-08T13:10:09.808928",
            "replies": []
        },
        {
            "id": 3,
            "title": "수정한 제목",
            "username": "test",
            "content": "수정한 내용입니다",
            "createdAt": "2022-12-08T13:08:30.122685",
            "modifiedAt": "2022-12-08T13:12:28.841916",
            "replies": [
               {
                    "replyId": 10,
                    "memoId": 8,
                    "replyName": "test",
                    "replyContent": "작성한 댓글"
                },
                {
                    "replyId": 9,
                    "memoId": 3,
                    "replyName": "test",
                    "replyContent": "작성한 댓글"
                }
            ]
        }
    ]
}
선택한
게시글

조회
GET /api/memos/{id}
@pathVariable : id
{
    "status": 200,
    "message": "OK",
    "data": {
        "id": 6,
        "title": "제목",
        "username": "test",
        "content": "내용",
        "createdAt": "2022-12-08T13:10:09.808928",
        "modifiedAt": "2022-12-08T13:10:09.808928",
        "replies": [
            {
                "replyId": 8,
                "memoId": 6,
                "replyName": "test",
                "replyContent": "작성한 댓글"
            }
        ]
    }
}
 게시글
작성
POST /api/memos Header : 
Authorization : Bearer <JWT>

Body :
{
    "title" : "제목",
    "content" : "내용"
}
{
    "status": 200,
    "message": "OK",
    "data": {
        "id": 3,
        "title": "제목",
        "username": "test",
        "content": "내용",
        "createdAt": "2022-12-08T13:08:30.1226851",
        "modifiedAt": "2022-12-08T13:08:30.1226851",
        "replies": []
    }
}
선택한
게시글

수정
PUT /api/memos/{id} @pathVariable : id,

Header : 
Authorization : Bearer <JWT>

Body :
{
    "title" : "수정한 제목",
    "content" : "수정한 내용입니다"
}
{
    "status": 200,
    "message": "OK",
    "data": {
        "id": 3,
        "title": "수정한 제목",
        "username": "test",
        "content": "수정한 내용입니다",
        "createdAt": "2022-12-08T13:08:30.122685",
        "modifiedAt": "2022-12-08T13:08:30.122685",
        "replies": [
            {
                "replyId": 9,
                "memoId": 3,
                "replyName": "test",
                "replyContent": "작성한 댓글"
            }
        ]
    }
}
선택한
게시글

삭제
DELETE /api/memos/{id}
@pathVariable : id

Header : 
Authorization : Bearer <JWT>
{
    "status": 200,
    "message": "OK"
}
댓글
작성
POST /api/memos/{id} @pathVariable : id

Header : 
Authorization : Bearer <JWT>

{
    "replyContent" : "작성한 댓글"
}
{
    "status": 200,
    "message": "OK",
    "data": {
        "replyId": 4,
        "memoId": 3,
        "replyName": "test",
        "replyContent": "작성한 댓글"
    }
}
댓글
수정
PUT /api/memos/{id}/{replyId} @pathVariable : id, replyId

Header : 
Authorization : Bearer <JWT>

{
    "replyContent" : "수정한 댓글"
}
{
    "status": 200,
    "message": "OK",
    "data": {
        "replyId": 13,
        "memoId": 5,
        "replyName": "test",
        "replyContent": "수정한 댓글"
    }
}
댓글
삭제
DELETE /api/memos/{id}/{replyId} @pathVariable : id, replyId

Header : 
Authorization : Bearer <JWT>
{
    "status": 200,
    "message": "OK"
}

좋아요
선택
POST /api/memos/{id}/like @pathVariable : id

Header : 
Authorization : Bearer <JWT>
{
    "status": 200,
    "message": "OK",
    "data": {
        "id": 3,
        "like_cnt": 4
    }
}

좋아요
취소
DELETE /api/memos/{id}/like @pathVariable : id

Header : 
Authorization : Bearer <JWT>
{
    "status": 200,
    "message": "OK",
    "data": {
        "id": 3,
        "like_cnt": 3
    }
}
댓글
좋아요
선택
POST /api/memos/{id}/{replyId}/like @pathVariable : id, replyId

Header : 
Authorization : Bearer <JWT>
{
    "status": 200,
    "message": "OK",
    "data": {
        "replyId": 4,
        "like_cnt": 3
    }
}
댓글
좋아요
취소
DELETE /api/memos/{id}/{replyId}/like @pathVariable : id, replyId

Header : 
Authorization : Bearer <JWT>
{
    "status": 200,
    "message": "OK",
    "data": {
        "replyId": 4,
        "like_cnt": 2
    }
}

 

 

 

ERD

 

스프링 심화 주차 ERD

Draw ERD with your team members. All states are shared in real time. And it's FREE. Database modeling tool.

www.erdcloud.com

 

+ Recent posts