node

node -> typeorm

RNDK 2023. 1. 19. 10:55

 typeorm 이란?

 

 -> 노드에서 실행되고 typescript로 작성된 객체 관계형 매퍼 라이브러리이다.

-> mysql, postgresql, mariadb, 등 여러 데이터베이스를 지원한다.

 

설치 방법

 - > npx typeorm init

 

설정 방법

 export const AppDataSource = new DataSource({

type: "postgres",
host: "localhost",
port: 5432,
username: "postgres",
password: "password",
database: "postgres",
synchronize: true,
logging: false,
entities: ["src/entity/**/*.ts"],
migrations: [],
subscribers: [],
});

appDataSource를 docker-compose에 맞춰서 username, password, database, port를 설정해준다.