File tree Expand file tree Collapse file tree 4 files changed +26
-1
lines changed
Expand file tree Collapse file tree 4 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 2727 "@nestjs/passport" : " ^7.0.0" ,
2828 "@nestjs/platform-express" : " ^7.0.0" ,
2929 "@nestjs/schedule" : " ^0.4.0" ,
30+ "@nestjs/serve-static" : " ^2.1.1" ,
3031 "@nestjs/swagger" : " ^4.4.0" ,
3132 "class-transformer" : " ^0.2.3" ,
3233 "class-validator" : " ^0.12.2" ,
Original file line number Diff line number Diff line change 11import { Module } from '@nestjs/common' ;
22import { MikroOrmModule } from 'nestjs-mikro-orm' ;
33import { ScheduleModule } from '@nestjs/schedule' ;
4- import { ConfigModule } from '@nestjs/config' ;
4+ import { ConfigModule , ConfigService } from '@nestjs/config' ;
5+ import { ServeStaticModule } from '@nestjs/serve-static' ;
56import { AuthModule } from './auth/auth.module' ;
67import { MeetupsModule } from './meetups/meetups.module' ;
78import { UsersModule } from './users/users.module' ;
89import { ImagesModule } from './images/images.module' ;
910import { MaintenanceModule } from './maintenance/maintenance.module' ;
1011import config from './mikro-orm.config' ;
1112import { configuration } from './configuration' ;
13+ import { join } from 'path' ;
1214
1315@Module ( {
1416 imports : [
1517 ConfigModule . forRoot ( {
1618 isGlobal : true ,
1719 load : [ configuration ] ,
1820 } ) ,
21+ ServeStaticModule . forRootAsync ( {
22+ useFactory : ( configService : ConfigService ) => {
23+ const clientPath = configService . get ( 'clientPath' ) ;
24+ return clientPath
25+ ? [
26+ {
27+ rootPath : configService . get ( 'clientPath' ) ,
28+ exclude : [ '/api*' ] ,
29+ } ,
30+ ]
31+ : [ ] ;
32+ } ,
33+ inject : [ ConfigService ] ,
34+ } ) ,
1935 MikroOrmModule . forRoot ( config ) ,
2036 ScheduleModule . forRoot ( ) ,
2137 AuthModule ,
Original file line number Diff line number Diff line change @@ -4,4 +4,5 @@ export const configuration = () => ({
44 secret : process . env . SECRET ?? 'secret' ,
55 adminKey : process . env . ADMIN_KEY ,
66 dbRefreshCron : process . env . DB_REFRESH_CRON ,
7+ clientPath : process . env . CLIENT_PATH ,
78} ) ;
Original file line number Diff line number Diff line change 610610 " @angular-devkit/schematics" " 9.0.6"
611611 fs-extra "8.1.0"
612612
613+ " @nestjs/serve-static@^2.1.1 " :
614+ version "2.1.1"
615+ resolved "https://registry.yarnpkg.com/@nestjs/serve-static/-/serve-static-2.1.1.tgz#b18573bb14a52fc9ebc82fc887d1bc0846f1d18c"
616+ integrity sha512-hkrCm7R8BWE8k9iiFlRtBIw+/VR4SMWos3yErRvC12y1ADI7gWkbu46+urx8jlcMnOEQW/xTAWY51xe6miBvHQ==
617+ dependencies :
618+ path-to-regexp "0.1.7"
619+
613620" @nestjs/swagger@^4.4.0 " :
614621 version "4.5.7"
615622 resolved "https://registry.yarnpkg.com/@nestjs/swagger/-/swagger-4.5.7.tgz#f38d73c984af70f95655b2828c539fab5482129b"
You can’t perform that action at this time.
0 commit comments