Skip to content

Commit

Permalink
More refactors
Browse files Browse the repository at this point in the history
  • Loading branch information
markwylde committed Jan 12, 2021
1 parent 24b2687 commit 2d55a61
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# canhazdb client
# canhazdb-client
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/canhazdb/client)
[![GitHub package.json version](https://img.shields.io/github/package-json/v/canhazdb/client)](https://github.com/canhazdb/client/blob/master/package.json)
[![GitHub](https://img.shields.io/github/license/canhazdb/client)](https://github.com/canhazdb/client/blob/master/LICENSE)
Expand All @@ -12,8 +12,9 @@ trying to use the client.

### Client

#### Connecting
```javascript
const client = require('canhazdb/client');
const client = require('canhazdb-client');

const tls = {
key: fs.readFileSync('./certs/localhost.privkey.pem'),
Expand All @@ -22,11 +23,17 @@ const tls = {
requestCert: true /* this denys any cert not signed with our ca above */
};
const client = createClient('https://localhost:8063', { tls });
```

#### Making requests
```javascript
const document = await client.post('tests', { a: 1 });
const changed = await client.put('tests', { id: document.id }, { query: { b: 2 } });
const changedDocument = await client.getOne('tests', { query: { id: document.id } });
```

#### Using events
```javascript
// Capture an event based on regex
// client.on('.*:/tests/.*', ...)
// client.on('.*:/tests/uuid-uuid-uuid-uuid', ...)
Expand Down

0 comments on commit 2d55a61

Please sign in to comment.