mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-17 16:44:49 -04:00
Use useStaticAssets
instead of @nestjs/serve-static
`serve-static` does not work with `createTestingModule` and is not recommended when "just" serving a few images. See https://github.com/nestjs/serve-static/issues/240 Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
bd1a6e528e
commit
15db6a9b2a
4 changed files with 6 additions and 14 deletions
|
@ -1,11 +1,12 @@
|
|||
import { ValidationPipe } from '@nestjs/common';
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { NestExpressApplication } from '@nestjs/platform-express';
|
||||
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
||||
import { AppModule } from './app.module';
|
||||
import { NestConsoleLoggerService } from './logger/nest-console-logger.service';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
const app = await NestFactory.create<NestExpressApplication>(AppModule);
|
||||
const logger = await app.resolve(NestConsoleLoggerService);
|
||||
logger.log('Switching logger', 'AppBootstrap');
|
||||
app.useLogger(logger);
|
||||
|
@ -24,6 +25,10 @@ async function bootstrap() {
|
|||
transform: true,
|
||||
}),
|
||||
);
|
||||
// TODO: Get uploads directory from config
|
||||
app.useStaticAssets('uploads', {
|
||||
prefix: '/uploads',
|
||||
});
|
||||
await app.listen(3000);
|
||||
logger.log('Listening on port 3000', 'AppBootstrap');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue