npm.io
5.0.0 • Published 2 months ago

@varasto/remote-storage

Licence
MIT
Version
5.0.0
Deps
2
Size
8 kB
Vulns
0
Weekly
0

@varasto/remote-storage

npm

Storage implementation which retrieves and stores data to an remote server. Uses got library as it's HTTP client and works in Node.js environments.

Installation

$ npm install --save @varasto/remote-storage

Usage

npm

The package provies an function called createRemoteStorage which returns an object that is an implementation of Storage type and works as an Varasto HTTP API client.

Basic usage of the API looks like this:

import { createRemoteStorage } from '@varasto/remote-storage';

const storage = createRemoteStorage({ url: 'https://example.com/api/' });

The function takes an configuration object, which supports these settings:

Property Default value Description
url http://0.0.0.0:3000 URL where the API can be accessed from.
auth Optional authentication credentials.

The auth setting, when used, should be a simple object containing username and password properties.

const storage = createRemoteStorage({
  auth: {
    username: 'AzureDiamond',
    password: 'hunter2'
  }
});

Keywords