Monster.Data.Datasource.Server. WebConnect

The RestAPI is a class that enables a REST API server.

Constructor

new WebConnect(optionsopt)

The LocalStorage class encapsulates the access to data objects.

Parameters:
NameTypeAttributesDescription
optionsObject<optional>

options contains definitions for the datasource.

Since
  • 3.1.0
License
  • AGPLv3
Example
import {WebConnect} from '@schukai/monster/source/data/datasource/server/webconnect.mjs';

const ds = new WebConnect({
    url: 'https://httpbin.org/get'
});

ds.set({flag: true})
ds.write().then(() => console.log('done'));
ds.read().then(() => console.log('done'));

Members

defaults

Properties
NameTypeDefaultDescription
urlstring

Defines the resource that you wish to fetch.

connectionObject
Properties
NameTypeDefaultDescription
timeoutObject5000

Defines the timeout for the connection.

reconnect.timeoutNumber

The timeout in milliseconds for the reconnect.

reconnect.attemptsNumber

The maximum number of reconnects.

reconnect.enabledBool

If the reconnect is enabled.

writeObject{}

Options

Properties
NameTypeDescription
mappingObject

the mapping is applied before writing.

Properties
NameTypeDescription
transformerString

Transformer to select the appropriate entries

callbackArray.<Monster.Data.Datasource~exampleCallback>

with the help of the callback, the structures can be adjusted before writing.

sheathingObject
Properties
NameTypeDescription
objectObject

Object to be wrapped

pathstring

Path to the data

readObject{}

Options

Properties
NameTypeDescription
pathString

Path to data

mappingObject

the mapping is applied after reading.

Properties
NameTypeDescription
transformerString

Transformer to select the appropriate entries

callbackArray.<Monster.Data.Datasource~exampleCallback>

with the help of the callback, the structures can be adjusted after reading.

(static) instanceSymbol

This method is called by the instanceof operator.

This method is called by the instanceof operator.

Methods

close() → {Promise}

This method closes the connection.

This method closes the connection.

Returns:
Type: 
Promise

connect() → {Promise}

Returns:
Type: 
Promise

getClone() → {RestAPI}

Returns:
Type: 
RestAPI

isConnected() → {boolean}

Returns:
Type: 
boolean

read() → {Promise}

Returns:
Type: 
Promise

write() → {Promise}

Returns:
Type: 
Promise