@fly-easy-app/api
v1.8.2
Published
A JavaScript SDK for calling Fly Easy's backend API
Downloads
421
Readme
@fly-easy-app/api
This package provides functions to easily call Fly Easy's backend API.
Default Configuration
By default, the API packages uses the E2E (pre-production) endpoint as the baseUrl
and reads the API key from the environment variable REACT_APP_FLYEASY_API_SECRET
.
Overriding the baseUrl
You can override the baseUrl
by setting the REACT_APP_FLYEASY_API_URL
environment variable or by using the setConfig
method.
Note: the Fly Easy backend API URLs can be found in your admin dashboard.
Example: Using Environment Variable
REACT_APP_FLYEASY_API_URL=https://custom-api-url.com
Example: Using setConfig
import { setConfig } from "@fly-easy-app/api";
setConfig({ baseUrl: "https://custom-api-url.com" });
Setting the apiKey
You can set the apiKey
by setting the REACT_APP_FLYEASY_API_SECRET
environment variable or by using the setConfig
method.
Note: the API secret to authenticate when calling Fly Easy's backend API can be found in your admin dashboard.
Example: Using Environment Variable
REACT_APP_FLYEASY_API_SECRET=yoursecret12345
Example: Using setConfig
import { setConfig } from "@fly-easy-app/api";
setConfig({ apiKey: "yoursecret12345" });