Skip to content
This repository was archived by the owner on Sep 5, 2025. It is now read-only.

Commit 3556871

Browse files
authored
Update README.md
1 parent 8af149e commit 3556871

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ use a different version of this client.
6262

6363
| Dgraph version | dgraph-js-http version |
6464
| :------------: | :--------------------: |
65+
| >= 21.03.0 | >= _21.3.0_ |
6566
| >= 20.03.0 | >= _20.3.0_ |
6667
| >= 1.1 | >= _1.1.0_ |
6768

@@ -97,6 +98,24 @@ const dgraphClient = new dgraph.DgraphClient(clientStub);
9798

9899
To facilitate debugging, [debug mode](#debug-mode) can be enabled for a client.
99100

101+
### Create a Client for Dgraph Cloud Endpoint
102+
103+
If you want to connect to Dgraph running on your [Dgraph Cloud](https://cloud.dgraph.io) instance, then all you need is the URL of your Dgraph Cloud endpoint and the API key. You can get a client using them as follows:
104+
105+
```js
106+
const dgraph = require("dgraph-js-http");
107+
108+
//here we pass the cloud endpoint
109+
const clientStub = new dgraph.DgraphClientStub(
110+
"https://super-pail.us-west-2.aws.cloud.dgraph.io",
111+
);
112+
113+
const dgraphClient = new dgraph.DgraphClient(clientStub);
114+
115+
//here we pass the API key
116+
dgraphClient.setSlashApiKey("<api-key>");
117+
```
118+
100119
### Login into Dgraph
101120

102121
If your Dgraph server has Access Control Lists enabled (Dgraph v1.1 or above),

0 commit comments

Comments
 (0)