MSSQL 3

Nest.js + TypeORM 을 적용해보자.

이번에는 Nest.js 프로젝트에 TypeORM을 적용해 보자. 일부 관련된 자료 또는 TypeORM 공식 홈페이지에는 TypeORM의 CLI를 이용한 프로젝트 생성방법이 거론되고 있는데, 우리는 Nest를 이용해서 프로젝트를 생성할 것임으로 굳이 TypeORM을 글로벌로 설치할 필요는 없다. 먼저 현재 프로젝트에 설치부터 해주자. npm install typeorm reflect-metadata @nestjs/typeorm reflect-metadata는 TypeScript에서 데코레이터 메타데이터를 사용하는 데 필요한 라이브러리입니다. TypeScript는 데코레이터를 지원하는데, 이를 사용하면 클래스와 클래스 멤버에 메타데이터를 연결할 수 있습니다. TypeORM은 이러한 데코레이터를 사용하여 엔터..

Nest.js + mssql 연동하기

이번에는 nest.js와 mssql 을 연동해 보자. 먼저 mssql 라이브러리를 설치해 준다. npm install mssql 먼저 프로젝트에 Cors 이슈를 해결하기 위해 app에서 enableCors() 함수를 호출해 준다. import { NestFactory } from '@nestjs/core'; import { AppModule } from './app.module'; import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger'; async function bootstrap() { const app = await NestFactory.create(AppModule); const config = new DocumentBuilder() .s..

반응형