app.module.ts 1.2 KB

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