Express app image storage

Hi. I’m making an API and came across a problem: how to store images ?
There is the option to store them in mongodb in base64 encoding, but how do I display them in a page with HTML ?
On StackOverflow people suggested to somehow store the images(i guess on my local machine) and to retrieve them in HTML by URL.That I’m also not aware of how to do.
This API is for a small website for woodworks portfolio, so there wouldn’t be many images(and their size is less than 16MB each, so GridFS is excluded). I guess using Cloud Storage services isn’t the best option in this case.
I’m new to storing images to databases, so maybe you can share your opinion on that topic.

HTML (PNG image for this):

<img src="data:img/png;base-64, your-base-64-encoded-image-data-here" />

Or CSS if it’s a background image (jpeg for this one here):

background-image: url(data:img/jpeg;base-64, your-base-64-encoded-image-data-here);
1 Like