URI (end point) 는 명사형으로 작성.

path parameter 는 camelCase로 써주세요. 이유: 코드 상에서 사용되는 변수

API 별 성공했을 때의 response 형식

  1. GET → json type

    1. list 를 get 하는 API 일 경우, 값이 없다면 빈 배열을 그대로 response
  2. POST

    201 로 통일

    RFC 9110: HTTP Semantics

    If one or more resources has been created on the origin server as a result of successfully processing a POST request, the origin server SHOULD send a 201 (Created) response containing a Location header field that provides an identifier for the primary resource created (Section 10.2.2) and a representation that describes the status of the request while referring to the new resource(s).

    [header]

    Location: /posting/1
    

    [body]

    {
    	postingId: 1,
    }
    
  3. PUT/PATCH

    204 No Content

  4. DELETE

    204 No Content

실패했을 때의 응답 형식

NestJS 에서 제공하는 HTTPException 을 throw 하는 방식으로 에러 처리.

(메세지는 자세하게)

{
  “statusCode”: number,
  “message”: string,
  “error”: string
}

도메인 단수/복수

postings, users, hashtags 등등