[미니프로젝트] [1] 에서  access token을 생성 후에 local stroage 에 저장하는 경우

 

Rest API 의 규칙

  • GET 은 데이터를 획득
  • POST 는 데이터를 생성
  • Patch 는 데이터를 갱신
  • DELETE 는 그 데이터를 삭제

Rest API 의 규칙에 따르면 

  • sing in을 하면  데이터 jwt access token 을 생성 및 local storage에 저장 -> Post
    • 참고로 sing in은 기존 사용자의 "인증"을 수행하는 작업 - JWT 토큰은 영구적인 리소스가 아닌, 임시적인 인증 수단이여서 HTTP status code 는 200
  • sign out 을 하면 local storage 에서 jwt access token 이 삭제 -> Delete

 

Local storage 에 저장을 안하고 req 를 통해서  jwt access token을 front-end 에게 전달 한다면?

 

sign in -> jwt access token 을 생성 -> Post

  • jwt access token 을 저장하는 곳이 쿠키라면 

sign out ->  쿠키에서 jwt access token 삭제 -> Delete

 

 

하지만 sign out 을 하면 Get 이라는 주장도 아래에 존재

https://stackoverflow.com/questions/5868786/what-method-should-i-use-for-a-login-authentication-request

 

What method should I use for a login (authentication) request?

I would like to know which http method I should use when doing a login request, and why? Since this request creates an object (a user session) on the server, I think it should be POST, what do you ...

stackoverflow.com

  • sign in 을 하면 session 이 생성 -> Post
  • sign out 을 하면 session이 삭제 -> Delete

라는 주장에 

한 유저:
HTTP method Delete 는 서버에 있는 무언가를 지우는 것이지 session 과 같이 메모리를 사용하 것을 삭제하는 것에 적용하기에는 맞지 않다고 생각한다.
  • sign out 을 하면 -> Get 
  •  

 

1. 로컬에서 브랜치 이름 변경

1 -1 이름을 변경하고 싶은 브랜치로 이동 후

git branch -m {new-branch-name}

 

1- 2 main 으로 이동후

git branch -m {old-branch-name} {new-branch-name}

 

2. 이전의 브랜치를 local 및 remote 에서 삭제

git push origin --delete {old-branch-name}

 

3.  remote 에 새로운 브랜치 등록

git push origin -u {new-branch-name}

 

 

# 한번에 해결하는 방법

git push origin :{old-branch-name} {new-branch-name}

1. 브랜치 develope 의 브랜치 feature/posts 에서의 작업이 끝남

2. 브랜치 develope 으로 이동

3. develope 에서 merge 수행

git merge --squash {병합할 브랜치}
git commit -m "squash & merge"
  • merge 취소 방법
    1. git reflog or git log 를 입력해서 hash 확인 (git reflog 가 확인이 편리)
    2.  -- hard 이용 :  커밋되지 않은 모든 내용이 
      1. git reset --hard {hash}
      2. 바로 이전의 hash를 알지 못한 다면 아래 방법도 가능
        • git reset --hard HEAD~1
    3.  -- merge 이용
      1. git reset --merge  {hash}
      2. git reset --merge  HEAD~1

HTTP Header 에는 많은 정보가 담겨져 있는데

통신 중에 전송 되는 데이터의 형태에 대한 정보가 담겨져 있는

Media Types 혹은 MIME(Multipurpose Internet Mail Extensions) 이라고도 알려져있는

Content-Type이 있다.

 

Content-Type

  • Body로  보낸 데이터의 타입을 나타내는 것
  • Boby로 보낸 데이터의 타입과
    Content-Type에서 표시하는 데이터의 타입이
    다르면 정삭적으로 작동을 하지 않는다.
  • Get 요청 시에는 나타나지 않음
  • 표시방법:  type/sub-type

데이터 타입의 종류 

 

참고자료

https://developer.mozilla.org/ko/docs/Web/HTTP/Headers/Content-Type

.gitignore에 추가하지 않아서 

이미 추적되고 있는 파일들은 
.gitignore 파일에 나중에 추가하여도 추적이 멈추지 않는다

이럴때 아래 명령어 사용

 

git rm --cached [file name]

+ Recent posts