Implement OpenAPI documentation and enhance authentication featurescc012f32 years ago38 lines · 1.2 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 { AuthModule } |
| 13 | import { FlightsModule } |
| 14 | import { FlightModule } |
| 15 | |
| 16 | @Module({ |
| 17 | imports: [ |
| 18 | ConfigModule.forRoot({ |
| 19 | AuthModule, |
| 20 | AirportsModule, |
| 21 | AirlinesModule, |
| 22 | FlightsModule, |
| 23 | FlightModule, |
| 24 | ], |
| 25 | controllers: [AppController], |
| 26 | providers: [AppService], |
| 27 | }) |
| 28 | export class AppModule |
| 29 | configure(consumer: |
| 30 | consumer |
| 31 | .apply(AuthMiddleware) |
| 32 | .exclude('/v(.*)/auth/(login|register)') |
| 33 | .exclude('/v(.*)/airports') |
| 34 | .exclude('/v(.*)/airlines') |
| 35 | .exclude('/static/(.*)') |
| 36 | .forRoutes('*') |
| 37 | } |
| 38 | } |
,
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/auth/auth.module
'
;
from
'
./resources/flights/flights.module
'
;
from
'
./resources/flight/flight.module
'
;
isGlobal
:
true
}
)
,
implements
NestModule
{
MiddlewareConsumer
)
{
;