목록데이터시각화-KMG (29)
안녕하세요

https://obvious-waterlily-d51.notion.site/42773236022d461e92eeaa588e6e2c08?v=6bf893b444fc416287443893ac17e470 API - 전체 (1) A new tool for teams & individuals that blends everyday work apps into one. obvious-waterlily-d51.notion.site

서버 파일이 너무 길어져버렸습니다. 코드 정리 방법을 찾을 때가 왔습니다. 1) 우선 스키마와 모델의 모듈화를 합니다. server.js 아래와 같이 스키마를 정의하고 User를 User Collection에 연결하였습니다. // MongoDB 연결 설정 mongoose .connect(mongoURI, { useNewUrlParser: true, useUnifiedTopology: true, }) .then(() => { console.log("MongoDB에 연결되었습니다."); }) .catch((error) => { console.error("MongoDB 연결에 실패했습니다.", error); }); // Post 모델 스키마 정의 const postSchema = new mongoose.Sch..

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..

구현 목록 게시판 조회 게시글 작성 게시글 조회 게시글 권한 확인 게시글 수정 게시글 삭제 게시판 조회 // 게시판 조회 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/..