2021-04-13 21:53:58 +02:00
|
|
|
import { join } from 'path';
|
|
|
|
|
2021-06-14 16:09:40 +02:00
|
|
|
import { AuthDeviceModule } from '@ghostfolio/api/app/auth-device/auth-device.module';
|
2021-08-14 16:55:40 +02:00
|
|
|
import { RedisCacheModule } from '@ghostfolio/api/app/redis-cache/redis-cache.module';
|
|
|
|
import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module';
|
|
|
|
import { CronService } from '@ghostfolio/api/services/cron.service';
|
|
|
|
import { DataGatheringModule } from '@ghostfolio/api/services/data-gathering.module';
|
|
|
|
import { DataProviderModule } from '@ghostfolio/api/services/data-provider/data-provider.module';
|
|
|
|
import { ExchangeRateDataModule } from '@ghostfolio/api/services/exchange-rate-data.module';
|
|
|
|
import { PrismaModule } from '@ghostfolio/api/services/prisma.module';
|
2022-02-16 21:17:11 +01:00
|
|
|
import { TwitterBotModule } from '@ghostfolio/api/services/twitter-bot/twitter-bot.module';
|
2022-05-07 20:00:51 +02:00
|
|
|
import { BullModule } from '@nestjs/bull';
|
2022-08-15 18:17:57 +02:00
|
|
|
import { MiddlewareConsumer, Module, RequestMethod } from '@nestjs/common';
|
2021-04-13 21:53:58 +02:00
|
|
|
import { ConfigModule } from '@nestjs/config';
|
|
|
|
import { ScheduleModule } from '@nestjs/schedule';
|
|
|
|
import { ServeStaticModule } from '@nestjs/serve-static';
|
|
|
|
|
|
|
|
import { AccessModule } from './access/access.module';
|
2021-05-01 12:30:52 +02:00
|
|
|
import { AccountModule } from './account/account.module';
|
2021-04-13 21:53:58 +02:00
|
|
|
import { AdminModule } from './admin/admin.module';
|
|
|
|
import { AppController } from './app.controller';
|
|
|
|
import { AuthModule } from './auth/auth.module';
|
2022-05-26 18:59:29 +02:00
|
|
|
import { BenchmarkModule } from './benchmark/benchmark.module';
|
2021-04-13 21:53:58 +02:00
|
|
|
import { CacheModule } from './cache/cache.module';
|
2021-07-11 17:05:58 +02:00
|
|
|
import { ExportModule } from './export/export.module';
|
2022-08-15 18:17:57 +02:00
|
|
|
import { FrontendMiddleware } from './frontend.middleware';
|
2021-07-14 20:54:05 +02:00
|
|
|
import { ImportModule } from './import/import.module';
|
2021-04-13 21:53:58 +02:00
|
|
|
import { InfoModule } from './info/info.module';
|
|
|
|
import { OrderModule } from './order/order.module';
|
|
|
|
import { PortfolioModule } from './portfolio/portfolio.module';
|
2021-06-21 20:03:36 +02:00
|
|
|
import { SubscriptionModule } from './subscription/subscription.module';
|
2021-04-13 21:53:58 +02:00
|
|
|
import { SymbolModule } from './symbol/symbol.module';
|
|
|
|
import { UserModule } from './user/user.module';
|
|
|
|
|
|
|
|
@Module({
|
|
|
|
imports: [
|
|
|
|
AdminModule,
|
|
|
|
AccessModule,
|
2021-05-01 12:30:52 +02:00
|
|
|
AccountModule,
|
2021-06-14 16:09:40 +02:00
|
|
|
AuthDeviceModule,
|
2021-04-13 21:53:58 +02:00
|
|
|
AuthModule,
|
2022-05-26 18:59:29 +02:00
|
|
|
BenchmarkModule,
|
2022-05-07 20:00:51 +02:00
|
|
|
BullModule.forRoot({
|
|
|
|
redis: {
|
|
|
|
host: process.env.REDIS_HOST,
|
2022-05-29 07:18:57 -05:00
|
|
|
port: parseInt(process.env.REDIS_PORT, 10),
|
|
|
|
password: process.env.REDIS_PASSWORD
|
2022-05-07 20:00:51 +02:00
|
|
|
}
|
|
|
|
}),
|
2021-04-13 21:53:58 +02:00
|
|
|
CacheModule,
|
|
|
|
ConfigModule.forRoot(),
|
2021-08-14 16:55:40 +02:00
|
|
|
ConfigurationModule,
|
|
|
|
DataGatheringModule,
|
|
|
|
DataProviderModule,
|
|
|
|
ExchangeRateDataModule,
|
2021-07-11 17:05:58 +02:00
|
|
|
ExportModule,
|
2021-07-14 20:54:05 +02:00
|
|
|
ImportModule,
|
2021-04-13 21:53:58 +02:00
|
|
|
InfoModule,
|
|
|
|
OrderModule,
|
|
|
|
PortfolioModule,
|
2021-08-14 16:55:40 +02:00
|
|
|
PrismaModule,
|
2021-04-13 21:53:58 +02:00
|
|
|
RedisCacheModule,
|
|
|
|
ScheduleModule.forRoot(),
|
|
|
|
ServeStaticModule.forRoot({
|
|
|
|
serveStaticOptions: {
|
|
|
|
/*etag: false // Disable etag header to fix PWA
|
|
|
|
setHeaders: (res, path) => {
|
|
|
|
if (path.includes('ngsw.json')) {
|
|
|
|
// Disable cache (https://stackoverflow.com/questions/22632593/how-to-disable-webpage-caching-in-expressjs-nodejs/39775595)
|
|
|
|
// https://gertjans.home.xs4all.nl/javascript/cache-control.html#no-cache
|
|
|
|
res.set('Cache-Control', 'no-cache, no-store, must-revalidate');
|
|
|
|
}
|
|
|
|
}*/
|
|
|
|
},
|
|
|
|
rootPath: join(__dirname, '..', 'client'),
|
|
|
|
exclude: ['/api*']
|
|
|
|
}),
|
2021-06-21 20:03:36 +02:00
|
|
|
SubscriptionModule,
|
2021-04-13 21:53:58 +02:00
|
|
|
SymbolModule,
|
2022-02-16 21:17:11 +01:00
|
|
|
TwitterBotModule,
|
2021-04-13 21:53:58 +02:00
|
|
|
UserModule
|
|
|
|
],
|
|
|
|
controllers: [AppController],
|
2021-08-14 16:55:40 +02:00
|
|
|
providers: [CronService]
|
2021-04-13 21:53:58 +02:00
|
|
|
})
|
2022-08-15 18:17:57 +02:00
|
|
|
export class AppModule {
|
|
|
|
configure(consumer: MiddlewareConsumer) {
|
|
|
|
consumer
|
|
|
|
.apply(FrontendMiddleware)
|
|
|
|
.forRoutes({ path: '*', method: RequestMethod.ALL });
|
|
|
|
}
|
|
|
|
}
|