2️⃣Set up the SDK
After you have installed the SDK, you first need to set it up.
To get started, you have to instantiate and configure the AKKA SDK:
import { AKKA } from '@akkafinance/sdk'
const akka = new AKKA({})
// or
const { AKKA } = require("@akkafinance/sdk")
const akka = new AKKA({})
The optional config
parameter can be used to pass custom configuration to the SDK (Currently, only api url can be customized, but in the near future, many personal settings can be made):
type ConfigUpdate = {
apiUrl: string
}
The apiUrl
defines which backend should be called. This only has to be edited when accessing a dedicated API endpoint.
Node.js Compatibility
SDK uses native Fetch API and in Node.js 16 and lower versions fetch
is not natively included, so it needs to be added manually. To provide access to Fetch API you need to patch global
object using node-fetch or cross-fetch.
Here is an example using cross-fetch:
import fetch, { Headers, Request, Response } from 'cross-fetch'
if (!globalThis.fetch) {
const globalThisAny: any = globalThis
globalThisAny.fetch = fetch
globalThisAny.Headers = Headers
globalThisAny.Request = Request
globalThisAny.Response = Response
}
Last updated