codehousepig / boardAPI

[위코드 x 원티드] 백엔드 프리온보딩 선발 과제

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

boardAPI

[위코드 x 원티드] 백엔드 프리온보딩 선발 과제


구현한 방법과 이유에 대한 간략한 내용

사용언어: JavaScript
프레임워크: Express
구현한 방법: 라우팅 역할을 해주는 A.js 와 로직을 담당하는 A.ctrl.js 를 먼저 만들고, 테스트를 위한 간단한 view 를 만들었습니다.
이유: 스프링 부트를 이용한 MVC 디자인 패턴에 익숙하였고, 웹에서 더 많이 사용하는 JavaScript를 선택하였습니다.

자세한 실행 방법

(Postman 으로 테스트 진행)
0. 서버 실행


  1. 글 목록 확인
    Method: GET, 127.0.0.1:3000/posts (기본 size=10, page=1)

Method: GET, 127.0.0.1:3000/posts?size=5&page=3

  1. 글 확인 (Read)
    Method: GET, 127.0.0.1:3000/posts/20

  1. 글 작성 (Create)
    Method: POST, 127.0.0.1:3000/posts

  1. 글 수정 (Update)
    Method: PUT, 127.0.0.1:3000/posts/25

  1. 글 삭제 (Delete)
    Method: DELETE, 127.0.0.1:3000/posts/25

  1. 회원가입 화면 - view
    Method: GET, 127.0.0.1:3000/auth/signup

  1. 회원가입
    Method: POST, 127.0.0.1:3000/auth/signup

  1. 로그인 화면 - view
    Method: GET, 127.0.0.1:3000/auth/login

  1. 로그인
    Method: POST, 127.0.0.1:3000/auth/login_process


  1. 로그아웃 -> 11. 로그인, 회원가입 UI
    Method: GET, 127.0.0.1:3000/auth/logout -> Method: GET, 127.0.0.1:3000/


  1. 로그인 이후 글 작성 UI
    Method: POST, 127.0.0.1:3000/create

  1. 로그인 이후 글 삭제 UI
    Method: POST, 127.0.0.1:3000/delete

  1. 로그인 이후 글 수정 UI
    Method: POST, 127.0.0.1:3000/update

api 명세


3. 작성

POST /posts
  • Request
{
    "title":"test22",
    "content":"test...22"
}
  • Response
{
    "message": "Create Success!"
}

4. 수정

PUT /posts/{pno}
  • Request
{
    "title":"test25",
    "content":"test...25"
}
  • Response
{
    "message": "Update Success!"
}

5. 삭제

DELETE /posts/{pno}
  • Response
{
    "message": "Delete Success!"
}

회원

7. 가입

POST /auth/signup
  • Request
{
    "name":"user7",
    "passwd":"7777"
}
  • Response
redirect(`/`)

9. 로그인

POST /auth/login_process
  • Request
{
    "name":"user7",
    "passwd":"7777"
}
  • Response
redirect(`/`)

UI

12. 글 작성

POST /create
  • Request
{
    "title":"test22",
    "content":"test...22"
}
  • Response
redirect('/');

13. 글 삭제

POST /delete
  • Request
{
    "pno":"26"
}
  • Response
redirect('/');

14. 글 수정

POST /update
  • Request
{
    "pno":"18"
    "title":"loginupdate",
    "content":"update...user"
}
  • Response
redirect('/');

About

[위코드 x 원티드] 백엔드 프리온보딩 선발 과제


Languages

Language:JavaScript 90.8%Language:Pug 9.2%