[DOC] API Reference - boostcamp-2020/Project18-A-Boostagram GitHub Wiki

Feed

GET /feed/following/:userName?lastFeedId

팔로우한 사용자들의 게시물 목록 조회. 마지막 피드 id를 통해 추가 조회.

  • Required

image

  • Response
    • 실패: userId 없음(400), 서버 에러(500)
    • 성공(200)
[
    {
    	_ID: "507f1f77bcf86cd799439011",
    	author: {
    	    _ID: "507f1f77bcf86cd799439011",
    	    userName: "JuHyeon-Lee",
    	    profileImg: "https://......"
    	},
    	createdAt: "2020-11-23T09:00:00.000Z",
    	updatedAt: "2020-11-23T09:00:00.000Z",
        like: ["507f...", "507f...", ...],
    	content: "TIL",
    	location: "Seoul, Korea",
    	feedImg: [url1, url2, ...],
    	comments:[
        	{
    		    commentId: "507f1f77bcf86cd799439011", // 추후 논의
    		    author: {
    		        _ID: "507f1f77bcf86cd799439011",
    		        username: "HyoJoon Cha", 
    		        profileImg: "https://......"
    		    },
    		    like: ["507f...", "507f...", ...],
                    content: "Wow!",
    		    createdAt: "2020-11-23T09:00:00.000Z",
    		    updatedAt: "2020-11-23T09:00:00.000Z",
    		    comments: [comment1, comment2, ...]
    		}, 
            { 
                ...
            } 
        ]
    },
    { 
        ...
    },
    ...
]

GET /feed/explore?lastFeedId

탐색창 피드 조회 (모든 피드 조회)

  • Required

image

  • Response
    • 실패: 서버 에러(500)
    • 성공: 200
[
    {
    	_ID: "507f1f77bcf86cd799439011",
    	author: {
    	    _ID: "507f1f77bcf86cd799439011",
    	    userName: "JuHyeon-Lee",
    	    profileImg: "https://......"
    	},
    	createdAt: "2020-11-23T09:00:00.000Z",
    	updatedAt: "2020-11-23T09:00:00.000Z",
        like: ["507f...", "507f...", ...],
    	content: "TIL",
    	location: "Seoul, Korea",
    	feedImg: [url1, url2, ...],
    	comments:[
        	{
    		    commentId: "507f1f77bcf86cd799439011", // 추후 논의
    		    author: {
    		        _ID: "507f1f77bcf86cd799439011",
    		        username: "HyoJoon Cha", 
    		        profileImg: "https://......"
    		    },
    		    like: ["507f...", "507f...", ...],
                    content: "Wow!",
    		    createdAt: "2020-11-23T09:00:00.000Z",
    		    updatedAt: "2020-11-23T09:00:00.000Z",
    		    comments: [comment1, comment2, ...]
    		}, 
            { 
                ...
            } 
        ]
    },
    { 
        ...
    },
    ...
]

POST /feed

게시글 작성

  • Required

image

  • Response
성공: 201
실패: 잘못된 요청(400) 서버 에러(500)

POST /feed/like

게시물 좋아요 상태 변경

  • Required

image

  • Response
성공: 204
실패: 잘못된 요청(400) 서버 에러(500)

Comment

POST /comment

댓글 작성

  • Required

image

  • Response
성공: 201
실패: 잘못된 요청(400) 서버 에러(500)

User

GET /user/profile/:userName

유저 프로필 정보 및 해당 유저 게시글 조회

  • Required

image

  • Response
    • 성공: 200
    • 실패: 잘못된 요청(400) 서버 에러(500)
userInfo

{
  feedCount: 12,
  _id: 5fd1b56dcc597e2704a1acb3,
  userName: 'rlaqudrnr810',
  profileImg: 'https://avatars2.githubusercontent.com/u/39620410?v=4',      
  follow: [
    {
      userId: 5fd1b4ad6396064a5065cb2b,
      name: '',
      userName: 'JuHyeon-Lee',
      profileImg: 'https://avatars1.githubusercontent.com/u/24909656?v=4'   
    },
    {
      userId: 5fd1b4474f87246616549a9e,
      name: '',
      userName: 'chahtk',
      profileImg: 'https://avatars0.githubusercontent.com/u/44664867?v=4'   
    }
  ],
  follower: [
    {
      userId: 5fd1b4474f87246616549a9e,
      name: '',
      userName: 'chahtk',
      profileImg: 'https://avatars0.githubusercontent.com/u/44664867?v'     
    },
    {
      userId: 5fd1b4ad6396064a5065cb2b,
      name: '',
      userName: 'JuHyeon-Lee',
      profileImg: 'https://avatars1.githubusercontent.com/u/24909656?v'     
    }
  ],
  notiContents: [],
  __v: 0
}

feeds
[
  {
    feedImg: [ 'https://kr.object.ncloudstorage.com/a18/1607846013474-sns.PNG' ],
    _id: 5fd5c881e445726398f87884,
    author: {
      name: '',
      userName: 'rlaqudrnr810',
      profileImg: 'https://avatars2.githubusercontent.com/u/39620410?v',    
      userId: 5fd1b56dcc597e2704a1acb3
    },
    content: '눈온다잇',
    like: [ [Object] ],
    comments: [ [Object] ],
    createdAt: 2020-12-13T07:53:37.897Z,
    updatedAt: 2020-12-14T01:33:27.822Z,
    __v: 0
  },
	{
		...
	},
	...
]

POST /user/follow/:userName

다른 유저에게 팔로우 요청 / 해제

  • Required

image

  • Response
성공: 204
실패: 잘못된 요청(400), 서버 에러(500)

Search

GET /search/user/:value

추천 검색 조회

  • Required

image

  • Response
성공: 200 + 추천 유저정보 배열
실패: 서버 에러(500)

Login

GET /github

GitHub 로그인 요청

  • Required : None
  • Response
성공: 200
실패: 500

POST /image

이미지 업로드

  • Required

image

  • Response
성공: 200
실패: 500