File tree Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change 3
3
A Cosmos DB server implementation for testing your apps locally.
4
4
5
5
``` 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" );
12
9
13
10
cosmosServer ().listen (3000 , () => {
14
11
console .log (` Cosmos DB server running at https://localhost:3000` );
@@ -19,7 +16,10 @@ cosmosServer().listen(3000, () => {
19
16
async function runClient () {
20
17
const client = new CosmosClient ({
21
18
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 })
23
23
});
24
24
25
25
// initialize databases since the server is always empty when it boots
@@ -28,7 +28,7 @@ async function runClient() {
28
28
29
29
// use the client
30
30
// ...
31
- });
31
+ }
32
32
```
33
33
34
34
To run the server on cli:
Original file line number Diff line number Diff line change 30
30
"path-to-regexp" : " 3.1.0" ,
31
31
"big-integer" : " 1.6.46" ,
32
32
"int64-buffer" : " 0.99.1007" ,
33
- "path-to-regexp" : " 3.1.0" ,
34
33
"raw-body" : " 2.4.1" ,
35
34
"uuid" : " 3.3.3"
36
35
},
You can’t perform that action at this time.
0 commit comments