Skip to content

VSFe/flask_sandbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask_sample

설치 및 실행

1. 의존성 다운

pip3 install -r requirements.txt # virtualenv 사용 권장

2. DB 및 기본 설정

  • app/constants.py 수정 (db 설정에 맞춰 변경)
  • app/init.py 수정 (app.config['SERVER_NAME'] 및 app.config['DEBUG'] 변경)
  • 다음 명령어 입력
python3 manage.py db init
python3 manage.py db migrate

3. 서버 실행

python3 manage.py run

API 명세

회원 관련 API

POST signup

POST /user/signup
  • Request Example
{
    "fullname": "Kim Byeong Cheol",
    "email": "[email protected]",
    "password": "test1234"
}
  • Response
    • 200: Signup Success
    • 409: Signup Failed
    • 500: Internal Server Error.

POST login

POST /user/login
  • Request Example
{
    "email": "[email protected]",
    "password": "test1234"
}
  • Response
    • 200: Login Success
    • 404: User Not Found
    • 409: Login Failed
    • 500: Internal Server Error

GET logout

GET /user/logout
  • Response
    • 200: Login Success
    • 404: Not Logged in
    • 500: Internal Server Error

GET info

GET /user/info
  • Response
    • 200: Success
    • 500: Internal Server Error
{
    "status": "Loggedin",
    "fullname": "Kim Byeong Cheol",
    "email": "[email protected]"
}

게시판 관련 API

POST create

POST /board/create
  • Request Example
{
	"name" : "자유게시판"
}
  • 로그인이 선행 되어야 함.
  • Response
    • 200: Success
    • 404: User Not Found
    • 409: Created Failed
    • 500: Internal Server Error

GET read

GET /board/{board_name}
  • Response
    • 200: Success
    • 404: Board Not Found
    • 500: Internal Server Error
{
    "message" : "Read Success",
    "name" : "자유게시판",
    "article" : [
			...
    ]
}

DELETE delete

DELETE /board/{board_name}/delete
  • 로그인이 선행되어야 하며, 본인이 만든 게시판만 삭제할 수 있음.
  • 게시판에 글이 1개 이상 존재할 경우 삭제할 수 없음.
  • Response:
    • 200: Success
    • 404: Board Not Found
    • 409: Not Enough Permission, Board Has Articles
    • 500: Internal Server Error

POST update

POST /board/{board_name}/update
  • Request Example
{
    "name": "비밀게시판"
}
  • 로그인이 선행되어야 하며, 본인이 만든 게시판만 수정할 수 있음.
  • Response:
    • 200: Success
    • 404: Board Not Found
    • 409: Not Enough Permission
    • 500: Internal Server Error

게시물 관련 정보

POST create

POST /board/{board_name}/create
  • Request Example
{
    "title": "배가 고파요",
    "content": "말 나온 겸 오늘 야식이나 시켜먹으려고 하는데, 뭘 시켜야 잘 시켰다고 소문이 날까요?"
}
  • 로그인이 선행되어야 함.
  • Response:
    • 200: Success
    • 404: Board Not Found
    • 409: Not Enough Permission
    • 500: Internal Server Error

GET read

GET /board/{board_name}/{article_id}
  • Response:
    • 200: Success
    • 404: Article Not Found
    • 500: Internal Server Error

DELETE delete

DELETE /board/{board_name}/{article_id}/delete
  • 로그인이 선행되어야 하며, 본인의 글이 아니면 삭제할 수 없음.
  • Response:
    • 200: Success
    • 404: Article Not Found
    • 409: Not Enough Permission
    • 500: Internal Server Error

POST update

POST /board/{board_name}/{article_id}/update
  • 로그인이 선행되어야 하며, 본인의 글이 아니면 수정할 수 없음.
  • Response:
    • 200: Success
    • 404: Article Not Found
    • 409: Not Enough Permission
    • 500: Internal Server Error

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages