Skip to content

Instantly share code, notes, and snippets.

@DillonMemo
Last active February 16, 2021 09:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DillonMemo/b3baaa55131d445be60ef39651248661 to your computer and use it in GitHub Desktop.
Save DillonMemo/b3baaa55131d445be60ef39651248661 to your computer and use it in GitHub Desktop.
NestJS Configure Practice with TypeORM
NestJS
  ├─src
  │  ├─users  
  │  │  ├─users.module.ts  
  │  │  └─users.resolver.ts
  │  ├─app.module.ts
  │  └─main.ts
  ├─test
  │  └─...test files
  └─eslint,env,prettier etc config files
import { Module } from '@nestjs/common';
import { GraphQLModule } from '@nestjs/graphql';
import { TypeOrmModule } from '@nestjs/typeorm';
import { UsersModule } from './users/users.module';
@Module({
imports: [
GraphQLModule.forRoot({
autoSchemaFile: true, // == autoSchemaFile: join(process.cwd(), 'src/schema.gql'),
}),
TypeOrmModule.forRoot({
type: 'postgres',
host: 'localhost',
port: 5432,
username: 'dillon',
password: '',
database: 'testDB',
synchronize: true,
logging: true,
}),
UsersModule,
],
controllers: [],
providers: [],
})
export class AppModule {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment