mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 01:36:29 -05: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
|
@ -25,7 +25,6 @@
|
|||
"@nestjs/common": "^7.0.0",
|
||||
"@nestjs/core": "^7.0.0",
|
||||
"@nestjs/platform-express": "^7.0.0",
|
||||
"@nestjs/serve-static": "^2.1.3",
|
||||
"@nestjs/swagger": "^4.5.12",
|
||||
"@nestjs/typeorm": "^7.1.0",
|
||||
"class-transformer": "^0.2.3",
|
||||
|
|
|
@ -22,11 +22,6 @@ import { UsersModule } from './users/users.module';
|
|||
autoLoadEntities: true,
|
||||
synchronize: true,
|
||||
}),
|
||||
ServeStaticModule.forRoot({
|
||||
rootPath: join(__dirname, '..'),
|
||||
// TODO: Get uploads directory from config
|
||||
renderPath: 'uploads',
|
||||
}),
|
||||
NotesModule,
|
||||
UsersModule,
|
||||
RevisionsModule,
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -614,13 +614,6 @@
|
|||
"@angular-devkit/schematics" "9.1.7"
|
||||
fs-extra "9.0.0"
|
||||
|
||||
"@nestjs/serve-static@^2.1.3":
|
||||
version "2.1.3"
|
||||
resolved "https://registry.yarnpkg.com/@nestjs/serve-static/-/serve-static-2.1.3.tgz#bdcb6d3463d193153b334212facc24a9767046e9"
|
||||
integrity sha512-9xyysggaOdfbABWqhty+hAkauDWv/Q8YKHm4OMXdQbQei5tquFuTjiSx8IFDOZeSOKlA9fjBq/2MXCJRSo23SQ==
|
||||
dependencies:
|
||||
path-to-regexp "0.1.7"
|
||||
|
||||
"@nestjs/swagger@^4.5.12":
|
||||
version "4.5.12"
|
||||
resolved "https://registry.yarnpkg.com/@nestjs/swagger/-/swagger-4.5.12.tgz#e8aa65fbb0033007ece1d494b002f47ff472c20b"
|
||||
|
|
Loading…
Reference in a new issue