Science & Technology

#26 Project using Spring | Fetching Image

by Telusko

Share:

📚 Main topics

  • Fixing product fieldsCorrected mismatches in product field names so the description and stock quantity display properly in the UI. 0:00
  • Creating the image endpointAdded a controller mapping that fetches a product by ID and returns its image bytes with the image’s content type. 1:37
  • Testing the integrationAdded products and confirmed their images, descriptions, and stock quantities appear on the home and product pages. 4:44

✨ Key takeaways

  • Send the content typeReturning the image’s content type alongside its bytes helps the frontend display the image correctly. 3:10
  • Connect through an APIThe frontend gets product image data by requesting an API endpoint in the backend. 6:17

🧠 Lessons learned

  • Keep field names consistentMismatched names between the UI and backend can cause product details, such as stock and description, to be missing or incorrect. 0:34
  • Handle missing productsThe endpoint could be improved to handle requests for IDs that do not correspond to a product. 6:17

🏁 Conclusion/next steps

  • Continue product featuresImage fetching and product display are working; upcoming videos may cover updating and deleting products. 6:49

Transcript excerpt

0:00 so now let's work with that image part so in the UI where is the UI where is the UI in the UI when I click on home you can see the image is not coming here and even if I go inside it's not working and apart from this there were multiple issues the first one is it's still showing out of stock so we'll solve that and I think I know the problem in the description also we were getting that empty right so if I click on here there's no description we have enter the description also it is not showing the stock is because in the UI and in the in

0:34 the back end there's a name issue so name is same brand is same description what we are using is only uh the dis disk not description so if I change this I think it will affect some somewhere else I'm not sure uh but I think I have to change that in the front end yeah so I have to change it everywhere so I know the problem you will solve this I know uh so in your code uh in the back end change this uh names or maybe I will just change that fast okay what I will do is I will just go back to the product

🔒 The full, searchable transcript is available with Pro.

🔒 Unlock Premium Features

This is a premium feature. Upgrade to unlock unlimited Q&A, transcripts, mindmaps, and translations.

🔒 Unlock Premium Features

Access to Chat is a premium feature. Upgrade now to unlock unlimited studying tools.

🔒 Unlock Premium Features

Access to Mindmap is a premium feature. Upgrade now to unlock unlimited studying tools.

🔒 Unlock Premium Features

Access to Translation is a premium feature. Upgrade now to unlock unlimited studying tools.

Get unlimited summaries, Q&A, transcripts and more with Pro

Upgrade to Pro

Suggestions

🔒 Unlock Premium Features

Access to AI Suggestions is a premium feature. Upgrade now to unlock unlimited studying tools.