@hawapi/js-sdk
v1.2.0
Published
HawAPI SDK for JavaScript
Downloads
1
Maintainers
Readme
HawAPI - js-sdk
HawAPI SDK for JavaScript/TypeScript
Topics
Installation
Npm
npm install @hawapi/js-sdk
Yarn
yarn add @hawapi/js-sdk
Cdn
<script src="https://cdn.jsdelivr.net/npm/@hawapi/js-sdk/dist/index.umd.min.js"></script>
Usage
Init client
Javascript (UMD)
const client = HawAPI.createClient();
// Also valid:
// const { createClient } = HawAPI
// const client = createClient()
console.log('HawAPI client: ', client);
Javascript (ESM)
import { createClient } from '<path>';
const client = createClient();
console.log('HawAPI client: ', client);
Error handling
Then/Catch
const result = client
.getAll('actors')
.then((data) => data)
.catch((err) => console.error(err));
Try/Catch
let result;
try {
result = await client.getAll('actors');
} catch (err) {
console.error(err);
}
Repository template
This repository uses typescript-library-boilerplate as template.