0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Nest.js その4 typeorm.config.ts

Last updated at Posted at 2025-04-20




typeorm.config.ts
TypeORM を使うときの設定ファイルのこと。
NestJS や Node.js プロジェクトでデータベースに接続するための設定をまとめて管理する

import { DataSource } from 'typeorm';
import { UsersEntity } from '../entities/users.entity';
import { TodosEntity } from 'src/entities/todos.entity';
import { NewsEntity } from 'src/entities/news.entity';

export const AppDataSource = new DataSource({
  type: 'mysql',
  host: 'localhost',
  port: 3306,
  username: 'test',
  password: 'test',
  database: 'test',
  synchronize: true,
  entities: [UsersEntity,TodosEntity,NewsEntity],
});
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?