- node의 express 프레임워크를 이용하여 서버를 구성
- auth와 posts를 구분하여 라우터 생성
- mvc패턴으로 효율적인 구조 형성
- 토큰을 통한 사용자 인가
매소드 | URI | 설명(endpoint) |
---|---|---|
post | http://localhost:3000/auth/signup | 회원가입 |
post | http://localhost:3000/auth/login | 로그인 |
get | http://localhost:3000/posts | 모든 게시글 목록 |
get | http://localhost:3000/posts?limit=30&offset=0 | 0번 포스터부터 최대 30개 게시글 목록 |
post | http://localhost:3000/posts | 게시글 작성 |
put | http://localhost:3000/posts/id | 게시글 변경 |
delete | http://localhost:3000/posts/id | 게시글 삭제 |
{
id: string,
userid: string,
password: string,
name: string,
email: string,
}
- Request
{
userid,
password,
name,
email
}
- Response
{
token,
userid
}
- Request
{
userid,
password
}
- Response
{
token,
userid
}
{
id: string,
text: string,
author: string,
created_at: string
}
- Response
{
[post ...]
}
- Response
{
count,
[post ...]
}
- Request
{
text,
author
}
- Response
{
post
}
- Request
{
text
}
- Response
{
post
}
- Response
{
msg(success)
}