error handling
-
서버 포트 중복 오류 / Error: listen EADDRINUSE: address already in use ::: 5000error handling/debugging 2020. 7. 3. 01:26
서버를 실행 중인 터미널을 잘못 종료해서 포트가 계속 실행 중일 경우 강제로 종료하는 방법을 소개하려고 한다. 에러 메시지는 다음과 같이 뜰 것이다. Error: listen EADDRINUSE: address already in use :::5000 at Server.setupListenHandle [as _listen2] (net.js:1313:16) at listenInCluster (net.js:1361:12) at Server.listen (net.js:1449:7) 5000 포트를 이미 사용중이라고 뜨고 있다. 터미널에 다시 아래와 같이 입력하면 lsof -i tcp:5000 (
-
[github] commit 기록을 터미널에서 보는 방법error handling/Simple tips 2020. 7. 2. 15:47
git log --graph --oneline --decorate --all --date=format:'%Y-%m-%d %H:%M:%S' --pretty=format:'%Cred%h%Creset -%C(auto)%d%Creset %s %C(yellow)(%ad) %C(bold blue)%Creset' --abbrev-commit 이걸 치면 커밋 기록을 CLI로 터미널에서 볼 수 있다. * 이 커밋 * 과 * 사이에 삼각형이 계속 이어지는 것이 가장 예쁜 커밋 그래프를 예쁘게 만들려면 git rebase를 사용하는 것이 좋다.
-
[github] remote repository 공유가 안될 때 (remote: Repository not found)error handling/debugging 2020. 7. 1. 23:49
팀 프로젝트를 하는 중, 나와 함께 서버를 맡은 팀원과 깃헙 리파지토리를 공유해서 작업을 하기 위해서 git remote add pair [팀원의 github repository 링크] 위 명령어를 통해서 remote repository를 공유하고, git remote -v 를 터미널에 입력했을 때, originhttps://github.com/me/project.git (fetch) originhttps://github.com/me/project.git (push) pairhttps://github.com/pair/project.git (fetch) pairhttps://github.com/pair/project.git (push) 라는 결과가 터미널에 뜨는 것으로 보아 잘 등록이 된 것도 확인할 수 ..
-
서버와 클라이언트의 연결 상관 관계 ( + body-parser module)error handling/Simple tips 2020. 6. 25. 18:47
아래 코드는 클라이언트 코드의 일부이다. 서버와 연결하기 위해서 fetch를 사용했다. 잠깐 fetch에 대해서 부연설명을 하자면 fetch를 사용할 때는 두번째 parameter는 옵션으로 들어가는 부분인데 적어주지 않는다면 default method는 GET이 될 것이다. 다른 method를 활용하고 싶다면 POST를 두 번째 파라미터에 적어주어야 한다. fetch("http://localhost:4000/signin", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ email: this.state.email, password: this.state.password }) }) .then(r..
-
로그인 구현 시 session id 삽입error handling/Simple tips 2020. 6. 25. 17:48
보통 로그인이 성공하면 서버에 있는 session에 새로운 아이디를 심어주어 다음 로그인 시 활용하게 된다. 이 때, id라는 변수를 그대로 사용하면 기존에 있던 id값이 중복되기 때문에 userid 등 다른 변수를 사용해서 심어주어야 한다. signInController: (req, res) => { //TODO : 로그인 및 인증 부여 로직 작성 user .findOne({ where: { email: req.body.email, password: req.body.password } }) .then(result => { console.log(JSON.stringify(result)) //여기서 result 는 아래와 같다. //{"id":1,"email":"rnjsdhdus93@gmail.com","..