Skip to content
This repository has been archived by the owner on Sep 8, 2021. It is now read-only.

[kunlee, jolim] - 쿤리조림 #7

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.env
node_modules
.eslintrc.js
test
Binary file added Rush00-API/.DS_Store
Binary file not shown.
7 changes: 7 additions & 0 deletions Rush00-API/API-main.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# API

[Account](API/Account.md)

[Post](API/Post.md)

[Reply](API/Reply.md)
162 changes: 162 additions & 0 deletions Rush00-API/API/Account.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# Account

# LogIn / LogOut / SignUp

## POST: Log In

### Request

Path: `/account/login`

- Content-Type: json
- No cookie is required. Valid jwt-token will be rejected.
- Body:
- username: [string]
- password: [string]

### Response

- ✅ 201: Created

Successfully logged in

- Set-Cookie: a valid jwt-token
- Content-Type: json
- Body
- msg: `Successfully logged in`
- data:
- username: [string]
- ⛔️ 400: Bad Request

When no username or password detected or they are invalid

- Content-Type: json
- Body
- msg: `Bad request`
- ⛔️ 401: Unauthorized

When username or password is wrong

- Content-Type: json
- Body
- msg: `Wrong username or password`
- ⛔️ 409: Conflict

Already logged in

- Content-Type: json
- Body
- msg: `Already logged in`

## POST: Sign Up

### Request

Path: `/account/signup`

- Content-Type: json
- Body:
- username: [string]
- password: [string]

### Response

- ✅ 201: Created

Successfully signed up

- Content-Type: json
- Body
- msg: `Successfully signed up`
- ⛔️ 400: Bad Request

When no username or password detected or they are invalid

- Content-Type: json
- Body
- msg: `Bad request`
- ⛔️ 409: Conflict

When username alreay exists

- Content-Type: json
- Body
- msg: `User already exists`

## POST: Log Out

### Request

Path: `/account/logout`

- Cookie: a valid jwt-token

### Response

- ✅ 200: OK

Successfully logged out

- Content-Type: json
- Body
- msg: `Successfully logged out`
- ⛔️ 400: Bad Request

When there is no cookie

- Content-Type: json
- Body
- msg: `Bad request`
- ⛔️ 401: Unauthorized

When jwt-token is expired

- Content-Type: json
- Body
- msg: `Token expired`
- ⛔️ 409: Conflict

When username alreay exists

- Content-Type: json
- Body
- msg: `User already exists`

## GET: LogIn Check

### Request

Path: `/account/check`

- Cookie: a valid jwt-token

### Response

- ✅ 200: OK

The user is being logged in.

- Content-Type: json
- Body
- msg: `The user is being logged in`
- ⛔️ 400: Bad Request

When there is no jwt-token

- Content-Type: json
- Body
- msg: `Bad request`
- ⛔️ 401: Unauthorized

When jwt-token is expired

- Content-Type: json
- Body
- msg: `Token expired`
- ⛔️ 403: Forbidden

When there is no cookie

- Content-Type: json
- Body
- msg: `Not logged in`
Loading