Faroe

Faroe

Represents a Faroe server client.

Server errors are thrown as FaroeError. The error code is available from FaroeError.code. See each method for a list of possible error codes.

import { Faroe, FaroeError } from "@faroe/sdk"

const faroe = new Faroe(url, secret);

try {
    await faroe.createUser(password, clientIP);
} catch (e) {
    if (e instanceof FaroeError) {
        const errorCode = e.code;
    }
}

Errors caused by fetch() are wrapped as FaroeFetchError.

Constructor

function constructor(url: string, credential: string | null): this

Parameters

  • url: The base URL of the Faroe server (e.g. https://your-domain.com).
  • credential: The server credential.

Methods

Example

import { Faroe } from "@faroe/sdk"

const faroe = new Faroe("https://your-domain.com", process.env.FAROE_CREDENTIAL);