change UI of flight stats425c112a year ago60 lines · 2.0 KB | 1 | import { RedisModule } from '@liaoliaots/nestjs-redis'; |
| 2 | import { MiddlewareConsumer, Module |
| 3 | import { ConfigModule, ConfigService |
| 4 | |
| 5 | import { AppController } |
| 6 | import { AppService } |
| 7 | import { AuthMiddleware } |
| 8 | import { AirlinesModule } |
| 9 | import { AirportsModule } |
| 10 | import { AuthModule } |
| 11 | import { FlightModule } |
| 12 | import { FlightsModule } |
| 13 | import { AlertsModule } |
| 14 | import { ProfileModule } |
| 15 | |
| 16 | @Module({ |
| 17 | imports: [ |
| 18 | ConfigModule.forRoot({ |
| 19 | RedisModule.forRootAsync({ |
| 20 | useFactory: (configService: |
| 21 | const redisUrl = |
| 22 | configService.get('REDIS_URL |
| 23 | ); |
| 24 | return { |
| 25 | config: { |
| 26 | host: redisUrl.hostname |
| 27 | port: parseInt(redisUrl |
| 28 | password: redisUrl.password |
| 29 | db: redisUrl.pathname |
| 30 | ? parseInt(redisUrl. |
| 31 | : 0, |
| 32 | family: 0, |
| 33 | }, |
| 34 | }; |
| 35 | }, |
| 36 | inject: [ConfigService], |
| 37 | }), |
| 38 | AuthModule, |
| 39 | AirportsModule, |
| 40 | AirlinesModule, |
| 41 | FlightsModule, |
| 42 | FlightModule, |
| 43 | AlertsModule, |
| 44 | ProfileModule, |
| 45 | ], |
| 46 | controllers: [AppController], |
| 47 | providers: [AppService], |
| 48 | }) |
| 49 | export class AppModule |
| 50 | configure(consumer: |
| 51 | consumer |
| 52 | .apply(AuthMiddleware) |
| 53 | .exclude('/v(.*)/auth/(login|register)') |
| 54 | .exclude('/v(.*)/airports') |
| 55 | .exclude('/v(.*)/airlines') |
| 56 | .exclude('/static/(.*)') |
| 57 | .exclude(`/alerts/(.*)`) |
| 58 | .forRoutes('*') |
| 59 | } |
| 60 | } |
,
NestModule
}
from
'
@nestjs/common
'
;
}
from
'
@nestjs/config
'
;
from
'
./app.controller
'
;
from
'
./app.service
'
;
from
'
./middlewares/auth/auth.middleware
'
;
from
'
./resources/airlines/airlines.module
'
;
from
'
./resources/airports/airports.module
'
;
from
'
./resources/auth/auth.module
'
;
from
'
./resources/flight/flight.module
'
;
from
'
./resources/flights/flights.module
'
;
from
'
./resources/alerts/alerts.module
'
;
from
'
./resources/profile/profile.module
'
;
isGlobal
:
true
}
)
,
ConfigService
)
=>
{
new
URL
(
'
)
||
'
redis://localhost:6379
'
,
,
.
port
,
10
)
,
||
undefined
,
pathname
.
slice
(
1
)
,
10
)
implements
NestModule
{
MiddlewareConsumer
)
{
;