import type { INestApplication } from '@nestjs/common' ; import compression from 'compression' ; import session from 'express-session' ; import helmet from 'helmet' ; import passport from 'passport' ; export function middleware ( app ) { const isProduction = ( process . env . NODE_ENV === 'production' ) ; app . use ( compression ( ) ) ; app . use ( session ( { secret : 'tEsTeD' , resave : false , saveUninitialized : true , cookie : { secure : isProduction } , } ) ) ; app . use ( passport . initialize ( ) ) ; app . use ( passport . session ( ) ) ; app . use ( helmet ( { contentSecurityPolicy : isProduction ? undefined : false } ) ) ; return app ; }