@varasto/remote-storage
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

@varasto/remote-storage

npm

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

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

Readme

Keywords

Package Sidebar

Install

npm i @varasto/remote-storage

Weekly Downloads

2

Version

3.0.0

License

MIT

Unpacked Size

9.76 kB

Total Files

10

Last publish

Collaborators

  • rauli