UNPKG

@ekoopensource/sdk

Version:

Ekoopensource sdk to connect to the ekoopnsource grids and services

69 lines (47 loc) 1.45 kB
# EkoOpenBuild Node.js sdk > Nodejs API wrapper for [EkoOpenSource](https://ekoopensource.com) [![NPM](https://nodei.co/npm/@ekoopensource/sdk.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.org/package/@ekoopensource/sdk) ## Table of content * [Documentation](#documentation) * [Installation](#installation) * [Usage](#usage) ## Documentation Take a look at the [API Docs here](https://docs.ekoopensource.com/) ## Installation Install the package from [npm](https://www.npmjs.com/package/eos-sdk-js) by running ```bash $ npm install @ekoopensource/sdk ``` or ```bash $ yarn add @ekoopensource/sdk ``` ## Usage To use this sdk you need to first generate your API keys by registering as a node on Ekoopensource. ```javascript import { EOS } from '@ekoopensource/sdk'; const credentials = { clientId: 'CLIENT_KEY', // Your EkoopenSource CLIENTID goes Here clientSecret: 'SK_{SECRET_KEY}' // Your EkoopenSource CLIENTSECRET goes Here }; const EosSdk = new EOS(credentials) // Initiate the environment (optional) EosSdk.setEnviroment("live"); // Call A Node Fetch API try{ const doctors = await EosSdk.fetchData("health","doctors"); // do something with the doctors result } catch (e) { // catch Exception Error } // Call A Node POST API try{ const doctors = await EosSdk.postData("health","doctors", { ... }); // do something with the doctors result } catch (e) { // catch Exception Error }