@varasto/remote-storage

Varasto HTTP client that connects to remote storage

Usage no npm install needed!

<script type="module">
  import varastoRemoteStorage from 'https://cdn.skypack.dev/@varasto/remote-storage';
</script>

README

@varasto/remote-storage

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

Installation

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

Usage

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'
  }
});