express2 채팅방 스키마, API 만들기 (mongoDB, thunderClient) 채팅방 스키마를 먼저 만들어 보자.채팅방 생성->채팅방 접속->웹소켓 연결 및 구현->메세지 데이터 DB 연결 순서로 진행할 것이다. Room SchemanamepaticipantsuserIduserNameuserProfileImagejoinedAtlastRead (안읽은 메세지 확인용. 마지막으로 읽은 시간)createdAtupdatedAtlastMessage1. 스키마 만들기import mongoose from "mongoose";const roomSchema = new mongoose.Schema({ name: { type: String, required: [true, "방 이름은 필수입니다."], trim: true, }, participants: [ { use.. 2024. 12. 5. react+socket.io로 채팅 앱 구현하기 프로젝트를 하며 WebSocket을 이용해 채팅 기능을 구현할 일이 생겼는데, 채팅의 기술 원리를 잘 모르고 무작정 개발하니 백엔드와 소통도 잘 안되는 것 같아... node.js로 직접 구현해보며 공부해보기로 했다. 기술 스택client : react, typescriptserver : node.js, express, socket.ioDB: 추후에 mongoDB 연결 예정 완성 화면 미리보기1. react 세팅https://ko.vite.dev/guide/ ViteVite, 프런트엔드 개발의 새로운 기준ko.vite.devvite로 설치해줬다. $ npm create vite@latestNeed to install the following packages:create-vite@5.5.4Ok to pro.. 2024. 12. 4. 이전 1 다음