|
|
@ -1,6 +1,7 @@ |
|
|
|
import { join } from 'path'; |
|
|
|
import path, { join } from 'path'; |
|
|
|
import { Injectable } from '@nestjs/common'; |
|
|
|
import { Injectable } from '@nestjs/common'; |
|
|
|
import express from 'express'; |
|
|
|
import express from 'express'; |
|
|
|
|
|
|
|
import isDocker from 'is-docker'; |
|
|
|
import type { NestMiddleware } from '@nestjs/common'; |
|
|
|
import type { NestMiddleware } from '@nestjs/common'; |
|
|
|
|
|
|
|
|
|
|
|
@Injectable() |
|
|
|
@Injectable() |
|
|
@ -13,6 +14,10 @@ export class PublicMiddleware implements NestMiddleware { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// serve static files from public folder
|
|
|
|
// serve static files from public folder
|
|
|
|
express.static(join(process.cwd(), 'public'))(req, res, next); |
|
|
|
if (isDocker()) { |
|
|
|
|
|
|
|
express.static(join(process.cwd(), 'docker', 'public'))(req, res, next); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
express.static(join(process.cwd(), 'public'))(req, res, next); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|