albatrosary's blog

UI/UXとエンタープライズシステム

NestJS

ormconfig の記述

Jest's __dirname is src and NestJS's __dirname is dist. So if you want to use TypeORM's ormconfig for unit tests as well, we need to write a different definition. Jest import {ConnectionOptions} from 'typeorm'; const config: ConnectionOpti…

NestJS のプロジェクト作成時にやること

NestJS CLI のインストール % npm i -g @nestjs/cli NestJS 関連のプロジェクト生成 % nest new project-name % npm i nest-router -S % npm i class-transformer class-validator -S GCP 用の package.json { "name": "", "version": "0.0.1", "description…

NestJS でのバリデーション設定

ライブラリの登録 npm i class-validator, class-transformer -S ValidationPipe有効化 async function bootstrap() { const app = await NestFactory.create(AppModule); app.useGlobalPipes(new ValidationPipe()); @UsePipes(new ValidationPipe()) を使…

NestJS でエントリーファイルの変更

nestjs でエントリーファイルを指定するときに少し困ったので見たところを書いておく。簡単なところで nest-cli.json は次のように使ってる。困りごとは entryFile が main.ts がデフォだけどそこを app.ts に変えたかった。 だけども Nextjs とか NuxtJS と…