/typescript-blog

React.js | Redux | TypeScript | Node.js | MongoDB를 통해서 만든 블로그

Primary LanguageTypeScript

TypeScript BLOG

TS, React, Node, MongoDB 를 통해서 만든 블로그 웹 사이트

현재 돌아가고 있는 웹 사이트 주소입니다.

블로그 사이트

사용한 기술 스택

Front-End: React.js, TypeScript.

Back-End: Node.js, MongoDB.


API 소개

Auth

POST

회원가입: '/api/auth/register'

headers: {
  'Content-Type': 'application/json'
}

params: {

}

body: {
  username: string
  password: string
}

RESPONSE: {
  message: string,
  admin: boolean
}
POST

로그인: '/api/auth/login'

headers: {
  'Content-Type': 'application/json',
}

params: {

}

body: {
  username: string,
  password: string
}

RESPONSE: {
  success: boolean
  message: string,
  token: string | null
}
POST

자동 로그인: '/api/auto/check'

headers: {
  'Content-Type': 'application/json',
  'x-access-token': string
}

params: {

}

body: {

}

RESPONSE: {
  success: boolean | null,
  message: string | null,
  info: string | null
}

Category

POST

카테고리 조회: '/api/:category' || '/api/categories'

headers: {
  'Content-Type': 'application/json',
  'x-access-token': string
}

params: {
  category: string
}

body: {

}

RESPONSE: {
  success: boolean,
  message: string,
  value: Object[]
}
POST

카테고리 추가: '/api/:category'

headers: {
  'Content-Type': 'application/json',
  'x-access-token': string
}

params: {
  category: string
}

body: {

}

RESPONSE: {
  success: boolean,
  message: string,
  value: Object[]
}
PATCH

카테고리 변경: '/api/:category'

headers: {
  'Content-Type': 'application/json',
  'x-access-token': string
}

params: {
  category: string
}

body: {
  changeCategory: string
}

RESPONSE: {
  success: boolean,
  message: string,
  value: Object[]
}
DELETE

카테고리 삭제: '/api/:category'

headers: {
  'Content-Type': 'application/json',
  'x-access-token': string
}

params: {
  category: string
}

body: {
  doubleCheck: string
}

RESPONSE: {
  success: boolean,
  message: string,
  value: Object[]
}

Post

GET

포스트 조회: '/api/:category/:title?type={value}'

headers: {
  'Content-Type': 'application/json',
  'x-access-token': string
}

params: {
  category: string,
  title: string
}

query: {
  type: string, used as a number (type * 1)
}

body: {

}

RESPONSE: {
  success: boolean,
  message: string,
  value: Object[]
}
POST

포스트 추가: '/api/:category/:title'

headers: {
  'Content-Type': 'application/json',
  'x-access-token': string
}

params: {
  category: string,
  title: string
}

body: {
  subTitle: string,
  mainText: string
}

RESPONSE: {
  success: boolean,
  message: string,
  value: Object[]
}
PUT

포스트 수정: '/api/:category/:title'

headers: {
  'Content-Type': 'application/json',
  'x-access-token': string
}

params: {
  category: string,
  title: string
}

body: {
  changeCategory: string
  changeTitle: string,
  changeSubTitle: string,
  changeMainText: string
}

RESPONSE: {
  success: boolean,
  message: string,
  value: Object[]
}
DELETE

포스트  삭제: '/api/:category/:title'

headers: {
  'Content-Type': 'application/json',
  'x-access-token': string
}

params: {
  category: string,
  title: string
}

body: {

}

RESPONSE: {
  success: boolean,
  message: string,
  value: Object[]
}

Ripple

GET

댓글 조회: '/api/:category/:title/:writer/:toporchild?topID=value'

headers: {
  'Content-Type': 'application/json'
}

params: {
  category: string,
  title: string,
  toporchild: string ('top' | 'child')
}

body: {

}

RESPONSE: {
  success: boolean,
  message: string,
  value: Object[]
}
POST

댓글 추가: '/api/:category/:title/:writer/:toporchild?topID=value'

headers: {
  'Content-Type': 'application/json'
}

params: {
  category: string,
  title: string,
  writer: string,
  toporchild: string ('top' | 'child')
}

body: {
  ripple: string,
  password: string,
  topID: ObjectID
}

RESPONSE: {
  success: boolean,
  message: string,
  value: Object[]
}
PATCH

댓글 수정: '/api/:category/:title/:writer/:toporchild'

headers: {
  'Content-Type': 'application/json'
}

params: {
  category: string,
  title: string,
  writer: string,
  toporchild: string ('top' | 'child')
}

body: {
  password: string
  text: string
  topID: string
  rippleID: objectID
}

RESPONSE: {
  success: boolean,
  message: string,
  value: Object[]
}
DELETE

댓글 삭제: '/api/:category/:title/:writer/:toporchild'

headers: {
  'Content-Type': 'application/json'
}

params: {
  category: string,
  title: string,
  writer: string,
  toporchild: string ('top' | 'child')
}

body: {
  topID: string
  rippleID: ObjectID
  password: string
}

RESPONSE: {
  success: boolean,
  message: string,
  value: Object[]
}