app.module.ts 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { Module } from '@nestjs/common';
  2. import { APP_INTERCEPTOR } from '@nestjs/core';
  3. import { ServeStaticModule } from '@nestjs/serve-static';
  4. import { AppController } from './app.controller';
  5. import { AppService } from './app.service';
  6. import { ErrorInterceptor, TransformResInterceptor } from './interceptors';
  7. import { MilvusModule } from './milvus/milvus.module';
  8. import { CollectionsModule } from './collections/collections.module';
  9. import { UsersService } from './users/users.service';
  10. import { UsersModule } from './users/users.module';
  11. import { AuthModule } from './auth/auth.module';
  12. import { join } from 'path';
  13. import { PartitionsModule } from './partitions/partitions.module';
  14. import { SchemaModule } from './schema/schema.module';
  15. import { EventsModule } from './events/events.module';
  16. import { LoggingInterceptor } from './interceptors/index';
  17. @Module({
  18. imports: [
  19. ServeStaticModule.forRoot({
  20. rootPath: join(__dirname, '../../', 'build'),
  21. // renderPath: '/', // only root render static html
  22. }),
  23. MilvusModule,
  24. CollectionsModule,
  25. UsersModule,
  26. AuthModule,
  27. PartitionsModule,
  28. SchemaModule,
  29. EventsModule,
  30. ],
  31. controllers: [AppController],
  32. providers: [
  33. AppService,
  34. // global interceptors
  35. {
  36. provide: APP_INTERCEPTOR,
  37. useClass: ErrorInterceptor,
  38. },
  39. {
  40. provide: APP_INTERCEPTOR,
  41. useClass: TransformResInterceptor,
  42. },
  43. {
  44. provide: APP_INTERCEPTOR,
  45. useClass: LoggingInterceptor,
  46. },
  47. UsersService,
  48. ],
  49. })
  50. export class AppModule {}