@markwylde/eventbase
Version:
A distributed, event-sourced, key-value database built on top of **NATS JetStream**. Eventbase provides a simple yet powerful API for storing, retrieving, and subscribing to data changes, with automatic state synchronization across distributed instances a
22 lines (16 loc) • 484 B
text/typescript
import createEventbase from '../src/index';
async function main() {
const eventbase = await createEventbase({
streamName: 'mytodoapp',
nats: {
servers: ["localhost:4222", "localhost:4223"]
}
});
// Use the eventbase
await eventbase.put('testid', { a: 1 });
const data = await eventbase.get<{ a: number }>('testid'); // { a: 1 }
await eventbase.delete('testid');
console.log('DATA', data);
await eventbase.close();
}
main().catch(console.error);