I am new to the Wappler world (I really want it in my life), my first mission, to migrate a legacy system to wappler, in this legacy system, I have a table (BD) with a “logo” column with type “bytea”, then in the system legacy (NodeJS) I can receive in the API the bytes of the image and store it in the BD column, another URI of the API retrieves the bytes of the BD, applies the content-type and responds with the logo, so basically I have this scenario:
Logo upload:
POST: http://{endpoint}/institutions/e605d637-8eb6-479b-8dcf-bbcabd26f8eb
Get Logo:
GET: http://{endpoint}/institutions/e605d637-8eb6-479b-8dcf-bbcabd26f8eb
I have already observed some discussions about the bad practice of saving images in the database here on the forum, but it is a legacy system that I cannot change at this moment, I would like to know if there is any possibility of doing this in wappler.
Welcome to the community.
As you have correctly read, storing images is not a good approach.
With the latest releases, you now have the power of custom modules and formatters.
Since this looks like a NodeJS app, you can use it to convert the bytea type data to an image and return that in response.
The dataScheme definition in this hjson does exactly that.
But you have to make sure you return a value with the key bytes in the main js file where the logic is.