You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, install <code>gcloud</code> with npm and require it into your project:
20
27
</p>
21
28
<divhljs>$ npm install --save gcloud</div>
22
29
<divhljs>var gcloud = require('gcloud');</div>
30
+
<p>
31
+
There are a couple of ways to use the <code>gcloud</code> module.
32
+
</p>
33
+
<p>
34
+
If you are running your app on Google App Engine or Google Compute Engine, you won't need to worry about supplying connection configuration options to <code>gcloud</code>— we figure that out for you.
35
+
</p>
36
+
<p>
37
+
However, if you're running your app elsewhere, you will need to provide this information.
38
+
</p>
39
+
<divhljs>
40
+
// App Engine and Compute Engine
41
+
var gcloud = require('gcloud');
23
42
24
-
<articleng-if="isActiveDoc('datastore')">
25
-
<p>
26
-
The <code>gcloud.datastore</code> object gives you some convenience methods, as well as exposes a <code>Dataset</code> function. This will allow you to create a <code>Dataset</code>, which is the object from which you will interact with the Google Cloud Datastore.
27
-
</p>
28
-
<divhljs>
43
+
// Elsewhere
44
+
var gcloud = require('gcloud')({
45
+
keyFilename: '/path/to/keyfile.json'
46
+
});</div>
47
+
<p>
48
+
In any environment, you are free to provide these and other default properties, which eventually will be passed to the <code>gcloud</code> sub-modules (Datastore, Storage, etc.).
49
+
</p>
50
+
</article>
51
+
<hr>
52
+
<articleng-if="isActiveDoc('datastore')">
53
+
<h2>Overview</h2>
54
+
<p>
55
+
The <code>gcloud.datastore</code> object gives you some convenience methods, as well as exposes a <code>dataset</code> function. This will allow you to create a <code>dataset</code>, which is the object from which you will interact with the Google Cloud Datastore.
See <ahref="#/docs/datastore/dataset">the Dataset documentation</a> for examples of how to query the datastore, save entities, run a transaction, and others.
33
-
</p>
34
-
</article>
35
-
36
-
<articleng-if="isActiveDoc('storage')">
37
-
<p>
38
-
The <code>gcloud.storage</code> object contains a <code>Bucket</code> object, which is how you will interact with your Google Cloud Storage bucket.
39
-
</p>
40
-
<divhljs>
41
-
var storage = gcloud.storage;
42
-
var bucket = new storage.Bucket({
43
-
bucketName: 'MyBucket'
59
+
var dataset = datastore.dataset({
60
+
projectId: 'myProject',
61
+
keyFilename: '/path/to/keyfile.json'
44
62
});</div>
45
-
<p>
46
-
See examples below for more on how to upload a file, read from your bucket's files, create signed URLs, and more.
See <ahref="#/docs/datastore/dataset">the Dataset documentation</a> for examples of how to query the datastore, save entities, run a transaction, and others.
65
+
</p>
66
+
</article>
67
+
<articleng-if="isActiveDoc('storage')">
68
+
<h2>Overview</h2>
69
+
<p>
70
+
The <code>gcloud.storage</code> object contains a <code>bucket</code> object, which is how you will interact with your Google Cloud Storage bucket. See the guide on <ahref="https://developers.google.com/storage">Google Cloud Storage</a> to create a bucket.
71
+
</p>
72
+
<p>
73
+
See examples below for more on how to access your bucket to upload a file, read its files, create signed URLs, and more.
0 commit comments