Add serving of static assets under the relative URL '/public'

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2021-04-25 14:41:38 +02:00
parent 0c2900d1c0
commit af106fdf50
No known key found for this signature in database
GPG key ID: B97799103358209B
3 changed files with 8 additions and 0 deletions

1
.gitignore vendored
View file

@ -40,5 +40,6 @@ dist
public/uploads/*
!public/uploads/.gitkeep
!public/.gitkeep
uploads
test_uploads

0
public/.gitkeep Normal file
View file

View file

@ -55,6 +55,13 @@ async function bootstrap(): Promise<void> {
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');
}