Skip to content

Instantly share code, notes, and snippets.

@chnirt
Last active June 19, 2019 03:51
Show Gist options
  • Save chnirt/4e95d86eacc6aa1738c9f69c39ab70e5 to your computer and use it in GitHub Desktop.
Save chnirt/4e95d86eacc6aa1738c9f69c39ab70e5 to your computer and use it in GitHub Desktop.
NestJs
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { GraphQLModule } from '@nestjs/graphql';
import { UserModule } from './user/user.module';
import { TypeOrmModule } from '@nestjs/typeorm';
import { join } from 'path';
@Module({
imports: [
GraphQLModule.forRoot({
typePaths: ['./**/*.graphql'],
playground: true,
}),
TypeOrmModule.forRoot({
type: 'mongodb',
url:
'mongodb+srv://chnirt:chin04071803@chnirt-graphql-apollo-vg0hq.mongodb.net/nest?retryWrites=true&w=majority',
entities: [join(__dirname, '**/**.entity{.ts,.js}')],
synchronize: true,
useNewUrlParser: true,
logging: true,
}),
UserModule,
],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment