# @ciklum-toggler/node-sdk

> Ciklum toggler Server-side SDK for Nodejs

Latest version **0.1.16** (published 2020-04-15) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @ciklum-toggler/node-sdk
pnpm add @ciklum-toggler/node-sdk
yarn add @ciklum-toggler/node-sdk
bun add @ciklum-toggler/node-sdk
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.16 |
| Published | 2020-04-15 |
| First published | 2020-03-31 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 36 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ciklum |
| Maintainers | ciklum, lmaksym |
| Keywords | nodejs, @ciklum-toggler, feature-toggle, typescript |

## Links

- npm: https://www.npmjs.com/package/@ciklum-toggler/node-sdk
- Repository: https://github.com/ciklum-digital/ciklum-toggler-node-sdk
- Homepage: https://github.com/ciklum-digital/ciklum-toggler-node-sdk#readme
- Issues: https://github.com/ciklum-digital/ciklum-toggler-node-sdk/issues
- npm.io page: https://npm.io/package/@ciklum-toggler/node-sdk

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.1.16 (latest) — 2020-04-15
- 0.1.15 — 2020-04-15
- 0.1.14 — 2020-04-15
- 0.1.13 — 2020-04-10
- 0.1.12 — 2020-03-31
- 0.1.11 — 2020-03-31
- 0.1.10 — 2020-03-31
- 0.1.9 — 2020-03-31
- 0.1.8 — 2020-03-31
- 0.1.7 — 2020-03-31
- 0.1.6 — 2020-03-31
- 0.1.5 — 2020-03-31

## README

# @ciklum-toggler/node-sdk

@ciklum-toggler/node-sdk is easy way to integrate your nodejs application with ciklum toggler feature flags provider 

## Getting started

* Run `npm i -S @ciklum-toggler/node-sdk` or `yarn add @ciklum-toggler/node-sdk` to install module as dependency
* Import config from module to your index.js (root) 
```
import {
     config
   } from '@ciklum-toggler/node-sdk';
```
* Configure module settings
    * add config initialisation in you root file
    * add value for `toggleUrl` -  path to your instance of **Ciklum Toggler** and api endpoint mostly it's `/api/external-systems-access`
    * add value for `envKey` - sdk token for your environment
```
config.init({
        toggleUrl: '${path-to-your-instance}/api/external-systems-access',
        envKey: 'unique-env-sdk-key',
      });
```

## Usage
### Config options
*Example*

```
config.init({
        toggleUrl: '${path-to-your-instance}/api/external-systems-access',
        envKey: 'unique-env-sdk-key',
        cachePeriod: 1000, // - 1000ms 
        ssl: true
      });
```
* Parameter `cachePeriod` by default is disabled, if you add value in milliseconds it is automatically requested changes from **Ciklum Toggler**
* Parameter `ssl` by default false, it uses when  your **Ciklum toggler** instance configure under https transport 
### Service

*Example*

Import service where you are going to use it

```
import { featureToggle } from '@ciklum-toggler/node-sdk';

```

Usage service in your code

```
async function myMethod() {
    const isFeatureEnabled = await featureToggle.isEnabled('FEATURE_NAME'); //-return promise 
    const isFeatureDisabled = await featureToggle.isDisabled('FEATURE_NAME'); //-return promise 
}

```

## API

* Service
    * featureToggle.isEnabled - check if feature is enabled and return Promise<boolean>
    * featureToggle.isDisabled - check if feature is disabled and return Promise<boolean>

---
_Source: https://npm.io/package/@ciklum-toggler/node-sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
