gcloud-node - a Google Cloud Platform Client Library for Node.js
This post originally
appeared on the Google Cloud Platform
blog
Today we are announcing a new category of client libraries that has been built specifically
for Google Cloud Platform. The very first library,
gcloud-node, is
idiomatic and intuitive for Node.js developers. With today’s release, you can begin
integrating
Cloud
Datastore and
Cloud
Storage into your Node.js applications, with more Cloud Platform APIs and
programming languages planned.
The easiest way to get started is by installing the gcloud package using npm:
$ npm install gcloud
With gcloud installed, your Node.js code is simpler to write, easier to read, and cleaner to
integrate with your existing Node.js codebase. Take a look at the code required to retrieve
entities from Datastore:
var gcloud = require('gcloud');
var dataset = new gcloud.datastore.Dataset({
projectId: 'my-project',
keyFilename: '/path/to/keyfile.json' // Details at
//https://github.com/googlecloudplatform/gcloud-node#README
});
dataset.get(dataset.key('Product', 123), function(err, entity) {
console.log(err, entity);
});
gcloud is open-sourced on
Github; check out the
code, file issues and contribute a PR -
contributors
are welcome. Got questions? Post them on StackOverflow with the
[gcloud-node] tag.
Learn more about the Client Library for Node.js at
http://googlecloudplatform.github.io/gcloud-node/
and try gcloud-node today.
Posted by JJ Geewax, Software Engineer
Node.js is a trademark of Joyent, Inc. and npm is a trademark of npm, Inc.