npm install @nestjs/typeorm typeorm pg
npm i @nestjs/config
// app.module.ts
import { Module } from '@nestjs/common';
import { GraphQLModule } from '@nestjs/graphql';
import { ApolloDriver } from '@nestjs/apollo';
import { RestaurantsModule } from './restaurants/restaurants.module';
import { TypeOrmModule } from '@nestjs/typeorm';
@Module({
imports: [
GraphQLModule.forRoot({
driver: ApolloDriver,
autoSchemaFile: true,
}),
RestaurantsModule,
TypeOrmModule.forRoot({
type: 'postgres',
host: 'localhost',
port: 5432,
username: '설정한유저네임',
password: '설정한비밀번호',
database: 'uber-eats',
synchronize: true,
logging: true,
}),
],
controllers: [],
providers: [],
})
export class AppModule {}
TypeORM database 설정 옵션

localhost로 접속할 때는 password를 묻지 않으므로 아무 값이나 적어도 된다고 한다.