Hi all …
I’m trying r2 database for ecommerce app ( just testing )
FrontEnd code for creating a new product:
const newData = new FormData()
newData.append('image', image) // image.png not base64 format
newData.append('name', name)
newData.append('tag', tag)
newData.append('quantity', quantity)
newData.append('price', price)
newData.append('status', status)
const res = await api.post("?method=addProduct", newData);
in my worker I’m create an id ( for product and also as a key for R2 storage)
then append it to data
const newData = await request.formData()
newData.append('id', id)
await database.put(id, newData)
the Object added with key, etag, uploaded …etc but size is always 0 byte and no body
so how to save the product ( with best practice ) in database ?
thanks for all …