app.module.ts 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 { join } from 'path';
  10. import { PartitionsModule } from './partitions/partitions.module';
  11. import { SchemaModule } from './schema/schema.module';
  12. import { EventsModule } from './events/events.module';
  13. import { LoggingInterceptor } from './interceptors/index';
  14. import { CronsModule } from './crons/crons.module';
  15. import { ScheduleModule } from '@nestjs/schedule';
  16. @Module({
  17. imports: [
  18. // Milvus insight will be available in one docker, so we will build client files in server's client directory
  19. ServeStaticModule.forRoot({
  20. rootPath: join(__dirname, '../../', 'build'),
  21. // renderPath: '/', // only root render static html
  22. }),
  23. // used for connection and checking server stats
  24. // TODO: rename to Connect
  25. MilvusModule,
  26. // used for manage collection
  27. CollectionsModule,
  28. // used for manage partitions
  29. PartitionsModule,
  30. // used for manage index
  31. SchemaModule,
  32. // used for events communication
  33. EventsModule,
  34. CronsModule,
  35. ScheduleModule.forRoot(),
  36. ],
  37. controllers: [AppController],
  38. providers: [
  39. AppService,
  40. // global interceptors
  41. {
  42. provide: APP_INTERCEPTOR,
  43. useClass: ErrorInterceptor,
  44. },
  45. {
  46. provide: APP_INTERCEPTOR,
  47. useClass: TransformResInterceptor,
  48. },
  49. {
  50. provide: APP_INTERCEPTOR,
  51. useClass: LoggingInterceptor,
  52. },
  53. ],
  54. })
  55. export class AppModule {}