I want to be able to dynamically create buckets in Google Cloud Storage. I am using the MEAN.io stack, so I want to do this in Node.js on my backend. I'm having trouble finding apis to help me, is there a way to do this?
Thanks!
UPDATE: Here I've tried using the Google-Node.js api, but nothing is happening. I tried to then authenticate it in case that's the problem, but I'm not really sure where to go from here.
googleAuth.authenticate(
credentials.jwt,
function(err, token) {
if (err) console.log(err);
console.log(token);
googleapis
.discover('storage', 'v1')
.execute(function(err, client) {
if (err) console.log(err);
client.storage.buckets.insert({'project': credentials.project}, {'name': bucketname}).execute();
})
});
The Google Cloud Storage JSON API is probably the API you want to use. You can code against it directly, or you could use a library like the Google APIs Node.js Client .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.