ORM 이란?

TypeORM 이란?

TypeScript 로 작성된 객체 관계형 매퍼 라이브러리이다.

MySQL 과 TypeORM 을 사용하기 위해 설치해야하는 모듈

npm install mysql2 typeorm @nestjs/typeorm --save

TypeORM NestJS 공식문서

Documentation | NestJS - A progressive Node.js framework

TypeORM 설정파일 생성

// typeorm.config.ts

import { TypeOrmModuleOptions } from '@nestjs/typeorm';

export const typeORMConfig: TypeOrmModuleOptions = {
  type: 'mysql',
  host: '192.168.64.2',
  port: 3306,
  username: 'hyung',
  password: '비번',
  database: 'BoardProject',

  entities: [__dirname + '/../**/*.entity.{js.ts}'],    
  synchronize: true,
};