landing page1d2e031a year ago52 lines · 1.8 KB | 1 | import { join } from 'path'; |
| 2 | |
| 3 | import { MiddlewareConsumer, Module |
| 4 | import { ConfigModule } |
| 5 | import { ServeStaticModule } |
| 6 | |
| 7 | import { AppController } |
| 8 | import { AppService } |
| 9 | import { AuthMiddleware } |
| 10 | import { AirlinesModule } |
| 11 | import { AirportsModule } |
| 12 | import { AlertsModule } |
| 13 | import { AuthModule } |
| 14 | import { FlightModule } |
| 15 | import { FlightsModule } |
| 16 | import { ProfileModule } |
| 17 | import { RedisService } |
| 18 | |
| 19 | @Module({ |
| 20 | imports: [ |
| 21 | ConfigModule.forRoot({ |
| 22 | AuthModule, |
| 23 | AirportsModule, |
| 24 | AirlinesModule, |
| 25 | FlightsModule, |
| 26 | FlightModule, |
| 27 | AlertsModule, |
| 28 | ProfileModule, |
| 29 | ServeStaticModule.forRoot({ |
| 30 | rootPath: join(__dirname |
| 31 | exclude: ['/v*', |
| 32 | }), |
| 33 | ], |
| 34 | controllers: [AppController], |
| 35 | providers: [AppService, |
| 36 | exports: [RedisService], |
| 37 | }) |
| 38 | export class AppModule |
| 39 | configure(consumer: |
| 40 | consumer |
| 41 | .apply(AuthMiddleware) |
| 42 | .exclude('/v(.*)/auth/(login|register)') |
| 43 | .exclude('/v(.*)/airports') |
| 44 | .exclude('/v(.*)/airlines') |
| 45 | .exclude('/static/(.*)') |
| 46 | .exclude('/assets/(.*)') |
| 47 | .exclude('/features/(.*)') |
| 48 | .exclude('/icons/(.*)') |
| 49 | .exclude(`/alerts/(.*)`) |
| 50 | .forRoutes('*') |
| 51 | } |
| 52 | } |
,
NestModule
}
from
'
@nestjs/common
'
;
from
'
@nestjs/config
'
;
from
'
@nestjs/serve-static
'
;
from
'
./app.controller
'
;
from
'
./app.service
'
;
from
'
./middlewares/auth/auth.middleware
'
;
from
'
./resources/airlines/airlines.module
'
;
from
'
./resources/airports/airports.module
'
;
from
'
./resources/alerts/alerts.module
'
;
from
'
./resources/auth/auth.module
'
;
from
'
./resources/flight/flight.module
'
;
from
'
./resources/flights/flights.module
'
;
from
'
./resources/profile/profile.module
'
;
from
'
./services/redis/redis.service
'
;
isGlobal
:
true
}
)
,
,
'
..
'
,
'
web
'
)
,
'
/docs*
'
,
'
/alerts*
'
,
'
/.well-known*
'
]
,
RedisService
]
,
implements
NestModule
{
MiddlewareConsumer
)
{
;