Skip to content

Conversation

helenul
Copy link
Member

@helenul helenul commented Nov 23, 2026

Plant images are no longer sent as base64 inside the GraphQL responses. The backend now serves them as files from /images/:id, and GraphQL only returns a link to the image.

Changes

Backend

  • Express replaces Apollo's standalone server, so the backend can serve both /graphql and /images/:id (app.ts, listen.ts, server.ts).
  • images.ts sends the stored image as bytes with its content type and Cache-Control (one week), and answers 404 for a missing image, an unknown plant or a malformed id.
  • The plant queries return /images/<id> instead of the base64 string, and no longer read imageData from the database.

Frontend

  • toImageUrl (graphql/apiUrl.ts) resolves the image path against the API's address.
  • Plant images use loading="lazy".
  • /images is added to the Vite dev proxy.

Teammates also need to run npm run install:all after pulling main.

@helenul helenul requested a review from a team as a code owner November 23, 2026 12:03
@helenul helenul linked an issue Nov 23, 2026 that may be closed by this pull request
6 tasks
Copy link
Member

@alexajah alexajah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good after merging!

@helenul helenul merged commit 3121752 into main Nov 23, 2026
0 of 4 checks passed
@helenul helenul deleted the 168-serve-plant-images-as-separate-files branch November 23, 2026 13:30
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Serve plant images as separate files
2 participants