How to use the @nestjs/common.Module function in @nestjs/common

To help you get started, weโ€™ve selected a few @nestjs/common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bojidaryovchev / nest-angular / src / server / modules / auth / auth.module.ts View on Github external
import { authenticate } from 'passport';

// Strategies
import { LocalStrategy } from './passport/local.strategy';
import { JwtStrategy } from './passport/jwt.strategy';
import { FacebookStrategy } from './passport/facebook.strategy';
import { TwitterStrategy } from './passport/twitter.strategy';
import { GoogleStrategy } from './passport/google-plus.strategy';

import { UserModule } from '../user/user.module';
import { authProviders } from './auth.providers';
import { AuthService } from './auth.service';
import { AuthController } from './auth.controller';
import { bodyValidatorMiddleware } from './middlewares/body-validator.middleware';

@Module({
  imports: [UserModule],
  providers: [
    ...authProviders,
    AuthService,
    LocalStrategy,
    JwtStrategy,
    FacebookStrategy,
    TwitterStrategy,
    GoogleStrategy
  ],
  controllers: [AuthController]
})
export class AuthModule implements NestModule {
  public configure(consumer: MiddlewareConsumer) {
    consumer
      .apply(
github anton-g / quizify / server / src / spotify / spotify.module.ts View on Github external
import { Module, HttpModule, forwardRef } from "@nestjs/common";
import { SpotifyService } from "./spotify.service";
import { UserModule } from "../user/user.module";

@Module({
    imports: [
      HttpModule,
      forwardRef(() => UserModule)
    ],
    providers: [
      SpotifyService
    ],
    exports: [
      SpotifyService
    ]
})
export class SpotifyModule { }
github nestjs / nest / sample / 22-graphql-prisma / src / app.module.ts View on Github external
import { Module } from '@nestjs/common';
import { GraphQLModule } from '@nestjs/graphql';
import { GraphqlOptions } from './graphql.options';
import { PostsModule } from './posts/posts.module';
import { PrismaModule } from './prisma/prisma.module';

@Module({
  imports: [
    GraphQLModule.forRootAsync({
      useClass: GraphqlOptions,
    }),
    PrismaModule,
    PostsModule,
  ],
})
export class AppModule {}
github jo0ger / node-server / src / config / typeorm / typeorm.module.ts View on Github external
* -----
 * File Created: 2019-08-23 19:02:24, Fri
 * Author: Jooger (iamjooger@gmail.com)
 * -----
 * Last Modified: Monday, 26th August 2019 10:05:10 am
 * Modified By: Jooger (iamjooger@gmail.com>)
 * HISTORY:
 * Date      	By	Comments
 * ----------	---	---------------------------------------------------------
 */

import { Module } from '@nestjs/common'
import { VarModule } from '../var/var.module'
import { TypeormService } from './typeorm.service'

@Module({
  imports: [VarModule],
  providers: [TypeormService]
})
export class TypeormModule {}
github ashinzekene / generator-nestjs-app / generators / app / templates / 12-graphql-apollo / src / modules / app.module.ts View on Github external
Module,
  MiddlewaresConsumer,
  NestModule,
  RequestMethod,
} from '@nestjs/common';
import { graphqlExpress, graphiqlExpress } from 'apollo-server-express';
import {
  makeExecutableSchema,
  addMockFunctionsToSchema,
  mergeSchemas,
} from 'graphql-tools';
import { GraphQLModule, GraphQLFactory } from '@nestjs/graphql';

import { CatsModule } from './cats/cats.module';

@Module({
  modules: [CatsModule, GraphQLModule],
})
export class ApplicationModule {
  constructor(private readonly graphQLFactory: GraphQLFactory) {}

  configure(consumer: MiddlewaresConsumer) {
    const schema = this.createSchema();
    consumer
      .apply(graphiqlExpress({ endpointURL: '/graphql' }))
      .forRoutes({ path: '/graphiql', method: RequestMethod.GET })
      .apply(graphqlExpress(req => ({ schema, rootValue: req })))
      .forRoutes({ path: '/graphql', method: RequestMethod.ALL });
  }

  createSchema() {
    const typeDefs = this.graphQLFactory.mergeTypesByPaths('./**/*.graphql');
github nest-cloud / nestcloud / packages / schedule / schedule.module.ts View on Github external
import { Module, DynamicModule, Global } from '@nestjs/common';
import { NEST_SCHEDULE_PROVIDER } from './constants';
import { Schedule } from './schedule';
import { IGlobalConfig } from './interfaces/global-config.interface';

@Global()
@Module({})
export class ScheduleModule {
    static register(globalConfig?: IGlobalConfig): DynamicModule {
        const scheduleProvider = {
            provide: NEST_SCHEDULE_PROVIDER,
            useFactory: (): Schedule => {
                return new Schedule(globalConfig);
            },
        };
        return {
            module: ScheduleModule,
            providers: [scheduleProvider],
            exports: [scheduleProvider],
        };
    }
}
github ashinzekene / generator-nestjs-app / generators / app / templates / 01-cats-app / src / modules / cats / cats.module.ts View on Github external
import { Module } from '@nestjs/common';
import { CatsController } from './cats.controller';
import { CatsService } from './cats.service';

@Module({
    controllers: [CatsController],
    components: [CatsService],
})
export class CatsModule {}
github nestjs / nest / sample / 06-mongoose / src / cats / cats.module.ts View on Github external
import { Module } from '@nestjs/common';
import { MongooseModule } from '@nestjs/mongoose';
import { CatsController } from './cats.controller';
import { CatsService } from './cats.service';
import { CatSchema } from './schemas/cat.schema';

@Module({
  imports: [MongooseModule.forFeature([{ name: 'Cat', schema: CatSchema }])],
  controllers: [CatsController],
  providers: [CatsService],
})
export class CatsModule {}
github nestjs / nest / sample / 14-mongoose-base / src / app.module.ts View on Github external
import { Module } from '@nestjs/common';
import { CatsModule } from './cats/cats.module';

@Module({
  imports: [CatsModule],
})
export class AppModule {}
github magishift / magishift.core / example / modules / tenant / tenant.module.ts View on Github external
import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { AuthModule } from '../../../src/auth/auth.module';
import { DraftModule } from '../../../src/crud/draft/draft.module';
import { PubSubProvider } from '../../../src/crud/providers/pubSub.provider';
import { FileStorageModule } from '../../../src/fileStorage/fileStorage.module';
import { TenantController } from './tenant.controller';
import { Tenant } from './tenant.entity';
import { TenantMapper } from './tenant.mapper';
import { TenantResolver } from './tenant.resolver';
import { TenantService } from './tenant.service';

@Module({
  imports: [TypeOrmModule.forFeature([Tenant]), FileStorageModule, DraftModule, AuthModule],
  providers: [TenantService, TenantResolver, TenantMapper, PubSubProvider],
  controllers: [TenantController],
  exports: [TenantService],
})
export class TenantModule {}