Skip to content

ilsubyeega/jsonkv-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jsonkv-client

A simple client for jsonkv-server. It was specifically created for use in some broadcasts.

https://www.npmjs.com/package/jsonkv-client

Usage

$ pnpm i jsonkv-client
import { JsonKvClient, JsonKvListener } from 'jsonkv-client';

const client = new JsonKvClient('baseUrl', 'secret');

const getOp = await client.get('key');
const postOp = await client.post('key', 'value');
const putOp = await client.put('key', 'value');
// uses rfc6902, JSON patch.
// https://tools.ietf.org/html/rfc6902
const patchOp = await client.patch('key', [
  {op: 'replace', path: '/0/age', value: 21},
  {op: 'add', path: '/-', value: {first: 'Raphael', age: 37}},
]);

const listener = client.bulk_listen((l) => {
  l.listen("overall", () => console.log("overall updated", overall));
});

setTimeout(() => {
  console.log("overall yay", listener.get("overall"));
}, 5000);

TODO

  • Add tests
  • Add UI dashboard

License

Apache-2.0

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published