How can I send multiple images from oak to a browser client?
M3cubo opened this issue · comments
I have a frontend page, let's say it contains a gallery. Every image in the gallery is a file that I have in my server (not in the public directory), so I can use .fetch()
, to request them from Oak as blob
s and turn them into images.
But If I have many images, how should I request these from the browser? With multiple fetch
's in the client side?
On the server, I suppose I could write an oak route like this:
Router.get(["/images/:image_ID"], async (context) => {
let myBlob = getImageBlobFromID(context.params.image_ID)
context.response.body = myBlob;
});
...and call it many times. Theoretically and practically speaking, is that how I should do it?
(and let's assume I have not created an automatic spritesheet with all the images of that gallery)