GitHub - HawAPI/js-sdk: HawAPI SDK for JavaScript/TypeScript
HawAPI SDK for JavaScript/TypeScript
Topics
Installation
Npm
npm install @hawapi/js-sdk
Yarn
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.