Fixed static file location for production use

This commit is contained in:
Mutzi 2022-08-23 21:49:56 +02:00
parent 34ab0021d8
commit 6f245534f0

View File

@ -6,6 +6,7 @@ import { JWTAuthGuard, Role, RoleGuard } from './authguards';
import AuthModule from './modules/auth'; import AuthModule from './modules/auth';
import { ServeStaticModule } from '@nestjs/serve-static'; import { ServeStaticModule } from '@nestjs/serve-static';
import { join } from 'path'; import { join } from 'path';
import { cwd } from 'process';
declare const PROD: boolean | undefined; declare const PROD: boolean | undefined;
@ -35,7 +36,7 @@ class TestController {
ServeStaticModule.forRoot({ ServeStaticModule.forRoot({
rootPath: rootPath:
typeof PROD !== 'undefined' && PROD typeof PROD !== 'undefined' && PROD
? join(__dirname, 'frontend') ? join(cwd(), 'frontend')
: join(__dirname, '..', '..', 'frontend', 'dist'), : join(__dirname, '..', '..', 'frontend', 'dist'),
exclude: ['/api*'] exclude: ['/api*']
}), }),