Reputation: 2113
I have an app that displays a list of pictures with titles and descriptions. The app sends a get request to the node server, and I want it to respond with the pictures and the titles/descriptions. In order to send the images at the same time as the other stuff, I think I need to use the multipart/form-data Content-Type. How do I do that? The expressjs docs don't say anything about multipart responses as far as I can tell.
Upvotes: 6
Views: 1523
Reputation: 7037
In your case I would send only an initial response with image urls and then generate <img src="image.url">
in the front end.
You don't need multipart here because there will be two separate requests, one for the image metadata, and another when the browser displays the image (downloads the file).
Nevertheless I commented a use case example in which multipart responses seems to be the only way around, and currently cannot find a solution for that one, so thanks for asking.
Upvotes: 1