mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-01-11 06:41:15 +00:00
Merge pull request #912 from hedgedoc/feature/serverUploads
StaticServe: Fix serving images under uploads/
This commit is contained in:
commit
2367e3c31b
1 changed files with 8 additions and 3 deletions
11
src/main.ts
11
src/main.ts
|
@ -13,6 +13,7 @@ import { AppConfig } from './config/app.config';
|
||||||
import { MediaConfig } from './config/media.config';
|
import { MediaConfig } from './config/media.config';
|
||||||
import { NestConsoleLoggerService } from './logger/nest-console-logger.service';
|
import { NestConsoleLoggerService } from './logger/nest-console-logger.service';
|
||||||
import { setupPrivateApiDocs, setupPublicApiDocs } from './utils/swagger';
|
import { setupPrivateApiDocs, setupPublicApiDocs } from './utils/swagger';
|
||||||
|
import { BackendType } from './media/backends/backend-type.enum';
|
||||||
|
|
||||||
async function bootstrap() {
|
async function bootstrap() {
|
||||||
const app = await NestFactory.create<NestExpressApplication>(AppModule);
|
const app = await NestFactory.create<NestExpressApplication>(AppModule);
|
||||||
|
@ -35,9 +36,13 @@ async function bootstrap() {
|
||||||
transform: true,
|
transform: true,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
if (mediaConfig.backend.use === 'filesystem') {
|
if (mediaConfig.backend.use === BackendType.FILESYSTEM) {
|
||||||
app.useStaticAssets('uploads', {
|
logger.log(
|
||||||
prefix: mediaConfig.backend.filesystem.uploadPath,
|
`Serving ${mediaConfig.backend.filesystem.uploadPath} under 'uploads/'`,
|
||||||
|
'AppBootstrap',
|
||||||
|
);
|
||||||
|
app.useStaticAssets(mediaConfig.backend.filesystem.uploadPath, {
|
||||||
|
prefix: '/uploads/',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
await app.listen(appConfig.port);
|
await app.listen(appConfig.port);
|
||||||
|
|
Loading…
Reference in a new issue