0.3.0 • Published 3 years ago

varasto-client v0.3.0

Weekly downloads
5
License
MIT
Repository
github
Last release
3 years ago

varasto-client

Node.js client library for Varasto JSON key-value store. Uses axios for connecting to the server.

Installation

$ npm install --save varasto-client

Usage

The libary exports single class, Client, which when instantiated can be used to connect to Varasto server. Constructor of Client class takes an optional configuration object, which supports these settings:

PropertyDefault valueDescription
hostname0.0.0.0Hostname of the server to which to connect to.
port3000Port of the server to which to connect to.
securefalse  Whether HTTPS should be used or not.
authUsername and password for basic authentication.

Storing items

setItem(key: string, value: Object): Promise<void>

Attempts to connect to the server and store an item identified by key.

Retrieving items

getItem(key: string): Promise<Object|undefined>

Attempts to connect to the server and retrieve an item identified by key. Returned promise will resolve into value of the item, or undefined if the item does not exist.

Removing items

removeItem(key: string): Promise<Object|undefined>

Attempts to connect to the server and remove an item identified by key. Returned promise will resolve into value of the removed item, or undefined if the item does not exist.

Updating items

updateItem(key: string, value): Promise<Object|undefined>

Attempts to connect to the server and perform an partial update to an item identified by key. Returned promise will resolve into value of the updated item after the update, or undefined if the item does not exist.

0.3.0

3 years ago

0.2.0

5 years ago

0.1.0

5 years ago