Hey folks I have an existing API layer using google cloud functions, and I was looking a way to get the download url for an image in Cloud Storage using a specific api endpoint.
app.get('/api/images/:ref', async (req, res) => {
const { ref } = req.params
try {
const bucket = admin.storage().bucket('bucket name')
const path = ref
const img = await bucket.file(path).download()
return img
} catch (error) { return res.status(500).json(error.mesasge) }
}
)
and my refernce path for an image is like foldername/randomID
Will this be possible through an api endpoint through passing params.