- Are you trying to implement something like an open graph feature?
There will be many ways to implement what you are trying to achieve, and this is my humble opinion:
If the image link is your internal site’s link, you can just load the image on the client. But if the image is on an external site, depending on http protocol it can cause a mixed contents warning when you load this directly on a browser and if your site is using ssl.
So, if you can get the image binary on your server-side and save it in the mongo or another web-server like nginx, you can serve it from there. However, to do this, you need to do crawling in advance, or you can add a check logic and if the link already has collection in the DB that contains your internally saved image info, then you can serve it.
- or if you are asking about how to get the response, it depends on the pattern you want. Of course, you can use reactivity using pub-sub, then the client will load the newly added collection. Or if you implement synchronized method, you can display the result in the api callback.