목록전체 글 (529)
안녕하세요
![](http://i1.daumcdn.net/thumb/C150x150.fwebp.q85/?fname=https://blog.kakaocdn.net/dn/bmpaiL/btspkLkEMI9/kVvpqHzrOK7NLKOmlN2020/img.png)
1. nodejs로 배포를 할 때 실패를 하여 로그를 살펴보면 bcrypt 모듈을 찾을 수 없다는 에러가 발생한다. Error: /var/app/current/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node: invalid ELF header https://velog.io/@annkim7/elastic-beanstalk-%EB%B0%B0%ED%8F%AC-%ED%9B%84-%EC%97%90%EB%9F%AC elastic beanstalk 배포 후 에러 An error occurred in the Server Components render. The specific message is omitted in production builds to avoid le..
![](http://i1.daumcdn.net/thumb/C150x150.fwebp.q85/?fname=https://blog.kakaocdn.net/dn/bE0bm1/btsplM3JCh9/y1u6m1l5Z3caK1Y6TKbk2k/img.png)
구현 목록 게시판 조회 게시글 작성 게시글 조회 게시글 권한 확인 게시글 수정 게시글 삭제 게시판 조회 // 게시판 조회 app.get("/api/posts", async (req, res) => { try { const posts = await Post.find(); res.status(200).json({ message: `게시판 조회가 완료되었습니다.`, posts }); } catch (error) { console.error(error); res.status(500).json({ message: "게시판 조회 작업 수행 중 문제가 발생하였습니다." }); } }); DB에서 게시판을 조회한 뒤 찾은 게시물을 반환합니다. 게시글 작성 // 게시글 작성 app.post("/api/protected/..
회원가입, 로그인, 로그아웃, 회원탈퇴 이렇게 네가지를 구현합니다. // 회원 가입 app.post("/api/users/create", async (req, res) => { }); // 로그인 app.post("/api/users/login", async (req, res) => { }); //로그아웃 app.post("/api/protected/users/signout", async (req, res) => { }); //회원 탈퇴 app.delete("/api/protected/users/:userId/withdraw", async (req, res) => { }); 회원가입 구현 방법 DB에 저장된 user와 일치하는 id 또는 nickname이 존재하는지 확인합니다. 중복되는 유저가 존재하지 ..
이렇게 액세스토큰을 보낼 때 header 에는 Bearer와 contentType을 다음과 같이 포함하여 보냅니다. const result = await axios.post("/api/users/login", null, { headers: { Authorization: `Bearer ${cookieAccessToken}`, "Content-Type": "application/json", }, }); Bearer와 함께 보내는 것은 토큰의 인증방식을 가리키는 것입니다. -H 'Authorization: Bearer 2gbdx6oar67tqtcmt49t3wpcgycthx' \ Bearer 방식을 이용해 토큰을 인증하겠다는 것으로 이해하면 된다. Content-Type은 바디에 들어갈 내용의 형식을 지정합니다..