Skip to content

Instantly share code, notes, and snippets.

@bennettrogers
Created March 17, 2017 01:20
Show Gist options
  • Save bennettrogers/138b62de9827119ae58437672d7c7e54 to your computer and use it in GitHub Desktop.
Save bennettrogers/138b62de9827119ae58437672d7c7e54 to your computer and use it in GitHub Desktop.
Testing Google Cloud DataStore
// Before running, install the Google Cloud SDK:
// https://cloud.google.com/sdk/docs/
// Then authenticate using:
// `gcloud auth application-default login`
// Replace `PROJECT-ID` and `ENTITY-NAME`
const Datastore = require('@google-cloud/datastore');
const datastore = Datastore({
projectId: 'PROJECT-ID'
});
const key = datastore.key(['image', 'ENTITY-NAME']);
console.log('this happens immediately');
datastore.get(key, (err, entity) => {
console.log('this happens 80 seconds later');
console.log(entity);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment