[위코드 x 원티드] 백엔드 프리온보딩 선발 과제
사용언어: JavaScript
프레임워크: Express
구현한 방법: 라우팅 역할을 해주는 A.js 와 로직을 담당하는 A.ctrl.js 를 먼저 만들고, 테스트를 위한 간단한 view 를 만들었습니다.
이유: 스프링 부트를 이용한 MVC 디자인 패턴에 익숙하였고, 웹에서 더 많이 사용하는 JavaScript를 선택하였습니다.
(Postman 으로 테스트 진행)
0. 서버 실행
- 글 목록 확인
Method: GET, 127.0.0.1:3000/posts (기본 size=10, page=1)
Method: GET, 127.0.0.1:3000/posts?size=5&page=3
- 글 확인 (Read)
Method: GET, 127.0.0.1:3000/posts/20
- 글 작성 (Create)
Method: POST, 127.0.0.1:3000/posts
- 글 수정 (Update)
Method: PUT, 127.0.0.1:3000/posts/25
- 글 삭제 (Delete)
Method: DELETE, 127.0.0.1:3000/posts/25
- 회원가입 화면 - view
Method: GET, 127.0.0.1:3000/auth/signup
- 회원가입
Method: POST, 127.0.0.1:3000/auth/signup
- 로그인 화면 - view
Method: GET, 127.0.0.1:3000/auth/login
- 로그인
Method: POST, 127.0.0.1:3000/auth/login_process
- 로그아웃 -> 11. 로그인, 회원가입 UI
Method: GET, 127.0.0.1:3000/auth/logout -> Method: GET, 127.0.0.1:3000/
- 로그인 이후 글 작성 UI
Method: POST, 127.0.0.1:3000/create
- 로그인 이후 글 삭제 UI
Method: POST, 127.0.0.1:3000/delete
- 로그인 이후 글 수정 UI
Method: POST, 127.0.0.1:3000/update
POST /posts
- Request
{
"title":"test22",
"content":"test...22"
}
- Response
{
"message": "Create Success!"
}
PUT /posts/{pno}
- Request
{
"title":"test25",
"content":"test...25"
}
- Response
{
"message": "Update Success!"
}
DELETE /posts/{pno}
- Response
{
"message": "Delete Success!"
}
POST /auth/signup
- Request
{
"name":"user7",
"passwd":"7777"
}
- Response
redirect(`/`)
POST /auth/login_process
- Request
{
"name":"user7",
"passwd":"7777"
}
- Response
redirect(`/`)
POST /create
- Request
{
"title":"test22",
"content":"test...22"
}
- Response
redirect('/');
POST /delete
- Request
{
"pno":"26"
}
- Response
redirect('/');
POST /update
- Request
{
"pno":"18"
"title":"loginupdate",
"content":"update...user"
}
- Response
redirect('/');