Skip to content

Commit a95f27e

Browse files
AndreMaznkzawa
authored andcommitted
Fix Readme example (#18)
* Stop using env var +remove duplicates from package Pass custom http agent to CosmosClient to avoid nodejs warnings * rever prettier lint
1 parent be7beaf commit a95f27e

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@
33
A Cosmos DB server implementation for testing your apps locally.
44

55
```js
6-
const { default: cosmosServer } = require('@zeit/cosmosdb-server');
7-
const { CosmosClient } = require('@azure/cosmos');
8-
9-
// disable SSL verification
10-
// since the server uses self-signed certificate
11-
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
6+
const { default: cosmosServer } = require("@zeit/cosmosdb-server");
7+
const { CosmosClient } = require("@azure/cosmos");
8+
const https = require("https");
129

1310
cosmosServer().listen(3000, () => {
1411
console.log(`Cosmos DB server running at https://localhost:3000`);
@@ -19,7 +16,10 @@ cosmosServer().listen(3000, () => {
1916
async function runClient() {
2017
const client = new CosmosClient({
2118
endpoint: `https://localhost:3000`,
22-
key: "dummy key"
19+
key: "dummy key",
20+
// disable SSL verification
21+
// since the server uses self-signed certificate
22+
agent: https.Agent({ rejectUnauthorized: false })
2323
});
2424

2525
// initialize databases since the server is always empty when it boots
@@ -28,7 +28,7 @@ async function runClient() {
2828

2929
// use the client
3030
// ...
31-
});
31+
}
3232
```
3333

3434
To run the server on cli:

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
"path-to-regexp": "3.1.0",
3131
"big-integer": "1.6.46",
3232
"int64-buffer": "0.99.1007",
33-
"path-to-regexp": "3.1.0",
3433
"raw-body": "2.4.1",
3534
"uuid": "3.3.3"
3635
},

0 commit comments

Comments
 (0)