Skip to content

Commit fbc8407

Browse files
committed
fix: Add getting started documentation.
1 parent 83f14d6 commit fbc8407

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

README.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
11
# eventsourcingdb
22

3-
The official JavaScript client SDK for EventSourcingDB.
3+
The official JavaScript client SDK for [EventSourcingDB](https://www.eventsourcingdb.io) – a purpose-built database for event sourcing.
4+
5+
EventSourcingDB enables you to build and operate event-driven applications with native support for writing, reading, and observing events. This client SDK provides convenient access to its capabilities in JavaScript and TypeScript.
6+
7+
For more information on EventSourcingDB, see its [official documentation](https://docs.eventsourcingdb.io/).
8+
9+
## Getting Started
10+
11+
Import the `Client` class and create an instance by providing the URL of your EventSourcingDB instance and the API token to use:
12+
13+
```typescript
14+
import { Client } from 'eventsourcingdb';
15+
16+
const url = new URL('http://localhost:3000');
17+
const apiToken = 'secret';
18+
19+
const client = new Client(url, apiToken);
20+
```
21+
22+
Then call the `ping` function to check whether the instance is reachable. If it is not, the function will throw an error:
23+
24+
```typescript
25+
await client.ping();
26+
```
27+
28+
*Note that `ping` does not require authentication, so the call may succeed even if the API token is invalid.*
29+
30+
If you want to verify the API token, call `verifyApiToken`. If the token is invalid, the function will throw an error:
31+
32+
```typescript
33+
await client.verifyApiToken();
34+
```

0 commit comments

Comments
 (0)