Primary Key, Foreign KeyPrimary Key: 식별할 수 있는 키(대표성) | 사용자가 정하는 칼럼Foreign Key: 참조하는 키데이터 모델링과 ER 모델데이터 모델링: 서비스에 데이터와 데이터 간 관계를 파악해 정교히 표현하는 것 | 보통 데이터모델링 후 스키마 정의함ER 모델(ER다이어그램)개체(entity): 현실 세계에 사물 또는 객체 | 하나의 개체 = 하나의 테이블속성(attribute): 개체의 세부 정보 | 하나의 속성 = 하나의 컬럼관계(relationship): 개체 간의 관계ER 모델링: 개체, 속성, 관계 후보 찾기하나의 값으로 표현할 수 없는 명사 = 개체의 후보하나의 값으로 표현할 수 있는 명사 = 속성의 후보동사 = 관계의 후보ER 모델링: 카디널리티개체..

Prisma 초기화npx prisma init --datasource-provider postgresql.env 파일에서windows의 경우 [postgres:password]로 변경하고, mydb를 생성할 db 이름 입력DATABASE_URL="postgresql://postgres:password@localhost:5432/comazon?schema=public"PORT=3000 User 모델 만들기// @id, @unique: 유니크한 값// @default(uuid()): uuid - 36자로 이뤄진 형식// ? : 값을 비워놔도 된다는 의미... NULL로 표시model User { id String @id email String @unique firstName Stri..
스키마 정의하기스키마: 데이터의 틀import mongoose from "mongoose";const TaskSchema = new mongoose.Schema( { titile: { type: String, }, description: { type: String, }, siComplete: { type: Boolean, default: false, }, }, { // timestamps 사용시 mongo가 알아서 create, update app 필드를 생성&관리함 timestamps: true, });// 첫..
라우트: 특정 엔드포인트를 담당하는 코드app.jsimport express from 'express';const app = express();// 첫번째 파라미터: url 경로 | 두번째 파라미터: 실행할 콜백함수app.get('/hello', (req, res) => { res.send('Hello Express!');});// 3000: 포트 번호app.listen(3000, () => console.log('Server Started'));쿼리스트링 처리하기쿼리스트링? url에서 물음표(?) 뒤에 오는 부분import express from 'express';import tasks from './data/mock.js'const app = express();app.get('/tasks', (..