app.module.ts 1.6 KB

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