본문 바로가기

개발공부_Blog184

JWT - JSON Web Token 항해99 첫주차 회원가입 / 로그인 페이지 구현 로그인한 사용자는 어떻게 계속 로그인 상태를 유지하면서 권한이 필요한 우리 서비스를 돌아다니는걸까? JWT 는 회원 로그인이 완료 되었을때 발행되는 토큰을 말한다. JWT에는 암호화 된 회원정보가 들어있으며 복호화를 통해 사이트내의 서비스를 사용할 수 있는지 확인 (인가 : Authorizationathon ) 하는데 사용한다. JWT는 JSON Web Token 의 약자로 전자서명 된 URL-safe : URL로 이용할 수 있는 문자로만 구성된 JSON 이다. 클라이언트와 서버, 서비스와 서비스 사이 통신 시 권한 인가(Authorization)를 위해 사용하는 토큰이다 JWT는 서버와 클라이언트 간 정보를 주고 받을 때 Http request heade.. 2022. 1. 16.
Date객체 2 - 시간, 분, 초 시계를 만들어봄, setInterval은 나중에 ㅋ function timeAMPM(){ const today = new Date().getHours if (today < 12){ AMPM.textContent = 'am' } else { AMPM.textContent = 'pm' } } timeAMPM() function getTime(){ const date = new Date() const hours = String(date.getHours()).padStart(2,'0') const minutes = String(date.getMinutes()).padStart(2,'0') const second = String(date.getSeconds()).padStart(2,'0') clock.textCo.. 2022. 1. 15.
Date객체 1 - 연도, 월, 일, 요일 요일을 만들어봄 function today(){ const date = new Date() const year = date.getFullYear() const month = date.getMonth()+1 const day = date.getDate() titleDay.textContent = (`${month}월 ${day}일` ) } today() function weekend(){ const date = new Date() const week = ['일요일', '월요일', '화요일', '수요일', '목요일', '금요일', '토요일'] const weekDay = week[date.getDay()] titleWeekend.textContent = (weekDay) } weekend() Date.pro.. 2022. 1. 15.
String.prototype.slice() 문자열의 일부를 새로운 문자열로 반환 String.prototype.slice() slice() 메소드는 문자열의 일부를 추출하면서 새로운 문자열을 반환합니다. 문법 str.slice(beginIndex[, endIndex]) 매개변수 beginIndex 추출 시작점인 0부터 시작하는 인덱스입니다. 만약 음수라면, beginIndex는 strLength(문자열 길이) + beginIndex로 취급됩니다. (예를 들어 beginIndex가 -3이면 시작점은 strLength - 3). 만약 beginIndex가 strLength 보다 크거나 같은 경우, slice()는 빈 문자열을 반환합니다. endIndex 0부터 시작하는 추출 종료점 인덱스로 그 직전까지 추출됩니다. 인덱스 위치의 문자는 추출에 포함되지 않습니다. 만약 endIndex가 .. 2022. 1. 15.
Array.prototype.slice() 배열에서 시작과 끝을 추출하는 함수 Array.prototype.slice() slice() 메서드는 어떤 배열의 begin부터 end까지(end 미포함)에 대한 얕은 복사본을 새로운 배열 객체로 반환합니다. 원본 배열은 바뀌지 않습니다. 구문 arr.slice([begin[, end]]) 예제 const animals = ['ant', 'bison', 'camel', 'duck', 'elephant']; console.log(animals.slice(2)); // expected output: Array ["camel", "duck", "elephant"] console.log(animals.slice(1, 4)); // expected output: Array ['bison', 'camel', 'duck'] console.log(ani.. 2022. 1. 15.
.repeat() 주어진 문자열을 횟수만큼 반복해 새로운 문자열 만들기 String.prototype.repeat() repeat() 메서드는 문자열을 주어진 횟수만큼 반복해 붙인 새로운 문자열을 반환합니다. String.prototype.repeat() - JavaScript | MDN repeat() 메서드는 문자열을 주어진 횟수만큼 반복해 붙인 새로운 문자열을 반환합니다. developer.mozilla.org 구문 str.repeat(count); 매개변수 count문자열을 반복할 횟수. 0과 양의 무한대 사이의 정수([0, +∞)) 반환값 현재 문자열을 주어진 횟수만큼 반복해 붙인 새로운 문자열. 예외 RangeError: 반복 횟수는 양의 정수여야 함. RangeError: 반복 횟수는 무한대보다 작아야 하며, 최대 문자열 크기를 넘어선 안됨. 예제 'abc'.r.. 2022. 1. 15.
git 파일 삭제, 수정 git 파일 삭제 ddddddddddgdsgs # git 파일 삭제 rm file.txt# 파일 삭제-> staging area에 적용해줘야함 git add file.txt# ataging area에서도 삭제 git이 포함된 명령어를 사용하면 git add를 사용해 staging area에서 파일을 또 삭제할 필요가 없이 한번에 지울 수 있다 # git명령어를 이용한 삭제 git rm file.txt # working directory와 staging area에서 삭제 git rm --cached file.txt# staging area에서만 삭제 git clean -fd # 모든 공간에서 삭제 git 파일 수정 # git 파일 이름변경 git mv from.txt to.txt git mv from.te.. 2022. 1. 7.
Git config GIt명령어 git config , 환경설정 git config --list#config 리스트보기 git config --global -e#config 설정 # 사용자 정보 설정 ( name, email ) git config --global user.name "name" git config --global user.email "email" # 사용자 정보 삭제 ( name, email ) git config --unset user.name git config --unset user.email git config --h 도움말 git config --help #detail git config -h #short 2022. 1. 7.
git commit git commit git commit -m "Commit message"#커밋 메시지와 함께 stagged 파일 커밋 git commit -am "Commit message" #모든 (커밋 메시지 + 파일) 커밋 commit 전에 git status로 상태확인 한번 하고 commit함 2022. 1. 7.