From af106fdf5014f72d89de216bc6fb7ce7a2d07db7 Mon Sep 17 00:00:00 2001 From: Tilman Vatteroth Date: Sun, 25 Apr 2021 14:41:38 +0200 Subject: [PATCH] Add serving of static assets under the relative URL '/public' Signed-off-by: Tilman Vatteroth --- .gitignore | 1 + public/.gitkeep | 0 src/main.ts | 7 +++++++ 3 files changed, 8 insertions(+) create mode 100644 public/.gitkeep diff --git a/.gitignore b/.gitignore index 99a0704cb..6fc591fbb 100644 --- a/.gitignore +++ b/.gitignore @@ -40,5 +40,6 @@ dist public/uploads/* !public/uploads/.gitkeep +!public/.gitkeep uploads test_uploads diff --git a/public/.gitkeep b/public/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/src/main.ts b/src/main.ts index 7b5cf6e3f..212922f91 100644 --- a/src/main.ts +++ b/src/main.ts @@ -55,6 +55,13 @@ async function bootstrap(): Promise { prefix: '/uploads/', }); } + logger.log( + `Serving the local folder 'public' under '/public'`, + 'AppBootstrap', + ); + app.useStaticAssets('public', { + prefix: '/public/', + }); await app.listen(appConfig.port); logger.log(`Listening on port ${appConfig.port}`, 'AppBootstrap'); }