My Node.js server is successfully connected to IBM Cloud Object Storage. I can create buckets and upload images using the cos.putObject
function. The images appears in the dashboard.
Here's how I upload an Image:
(It's working, I can see the images on the IBM Cloud Object Storage Dashboard inside the selected bucket)
function createTextFile(bucketName, itemName, fileText) {
console.log(`Creating new item: ${itemName}`);
return cos.putObject({
Bucket: bucketName,
Key: itemName,
Body: fileText
}).promise()
.then((data) => {
console.log(`Item: ${itemName} created!`);
function(err,url){
if(err){
console.log("err",err);
}
});
})
.catch((e) => {
console.log(`ERROR: ${e.code} - ${e.message}\n`);
});
}
The question is, how do I retrieve the URL of an images through Nodejs to display them into my front-end?
I can't find a good documentation for that. Please help! Thanks.