From 0669f8713460d152392769c2db97fd03cb0b3bb5 Mon Sep 17 00:00:00 2001 From: macanhhuy Date: Sat, 22 Aug 2026 12:19:50 +0700 Subject: [PATCH] fix: serve avatar files from node process (express.static) Single-container avatar service: serve the resized files from outputDir so the frontend can GET /.jpg without a separate nginx. --- app/app.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/app.js b/app/app.js index 3a2aa71..59196e9 100644 --- a/app/app.js +++ b/app/app.js @@ -44,6 +44,12 @@ app.use(bodyParser.raw( { limit: '10mb', type: 'image/*' })); app.use(logger('dev')); app.use(cors(corsOpts)); +// Serve the resized avatar files (GET /.jpg) straight from outputDir. +// The frontend reads `${avatarServiceUrl}/${hash}.jpg`; historically an nginx +// sharing the outputDir volume did this, but serving it from the node process +// keeps the deployment a single container with one port. +app.use(express.static(outputDir)); + // function store function resizeAndSave(buf, jidhash) { if (resolutions.length > 0) {