Skip to content

Commit 6eaff7e

Browse files
Update readme with Unleash description, fix minor typos (#707)
1 parent 8fd088e commit 6eaff7e

File tree

1 file changed

+35
-33
lines changed

1 file changed

+35
-33
lines changed

README.md

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22

33
[![Unleash node SDK on npm](https://img.shields.io/npm/v/unleash-client)](https://www.npmjs.com/package/unleash-client)
44
![npm downloads](https://img.shields.io/npm/dm/unleash-client)
5-
[![Build Status](https://github.com/Unleash/unleash-client-node/workflows/Build/badge.svg)](https://github.com/Unleash/unleash-client-node/actions)
5+
[![Build Status](https://github.com/Unleash/unleash-client-node/actions/workflows/build-and-test.yaml/badge.svg)](https://github.com/Unleash/unleash-client-node/actions)
66
[![Code Climate](https://codeclimate.com/github/Unleash/unleash-client-node/badges/gpa.svg)](https://codeclimate.com/github/Unleash/unleash-client-node)
77
[![Coverage Status](https://coveralls.io/repos/github/Unleash/unleash-client-node/badge.svg?branch=main)](https://coveralls.io/github/Unleash/unleash-client-node?branch=main)
88

9-
The official Unleash client SDK for Node.js.
9+
Unleash is a private, secure, and scalable [feature management platform](https://www.getunleash.io/) built to reduce the risk of releasing new features and accelerate software development. This server-side Node.js SDK is designed to help you integrate with Unleash and evaluate feature flags inside your application.
10+
11+
You can use this client with [Unleash Enterprise](https://www.getunleash.io/pricing?utm_source=readme&utm_medium=nodejs) or [Unleash Open Source](https://github.com/Unleash/unleash).
12+
1013

1114
## Getting started
1215

@@ -31,7 +34,7 @@ is asynchronous, but if you need it to be synchronous, you can
3134
[block until the SDK has synchronized with the server](#synchronous-initialization).
3235

3336
Note that until the SDK has synchronized with the API, all features will evaluate to `false` unless
34-
you a [bootstrapped configuration](#bootstrap).
37+
you have a [bootstrapped configuration](#bootstrap).
3538

3639
---
3740

@@ -118,7 +121,7 @@ const unleash = await startUnleash({
118121
customHeaders: { Authorization: '<YOUR_API_TOKEN>' },
119122
});
120123

121-
// Unleash SDK has now fresh state from the unleash-api
124+
// The Unleash SDK now has a fresh state from the Unleash API
122125
const isEnabled = unleash.isEnabled('Demo');
123126
```
124127

@@ -142,8 +145,8 @@ setInterval(() => {
142145
```
143146

144147
👀 **Note**: In this example, we've wrapped the `isEnabled` call inside a `setInterval` function. In
145-
the event that all your app does is to start the SDK and check a feature status, this is will keep a
146-
node app running until the SDK has synchronized with the Unleash API. It is **not** required in
148+
the event that all your app does is start the SDK and check a feature status, this setup ensures that the
149+
node app keeps running until the SDK has synchronized with the Unleash API. It is **not** required in
147150
normal apps.
148151

149152
#### Check variants
@@ -187,17 +190,17 @@ const enabled = unleash.isEnabled('someToggle', unleashContext);
187190

188191
### 4. Stop unleash
189192

190-
To shut down the client (turn off the polling) you can simply call the destroy-method. This is
193+
To shut down the client (turn off the polling) you can simply call the `destroy` method. This is
191194
typically not required.
192195

193196
```js
194197
import { destroy } from 'unleash-client';
195198
destroy();
196199
```
197200

198-
### Built in activation strategies
201+
### Built-in activation strategies
199202

200-
The client comes supports all built-in activation strategies provided by Unleash.
203+
The client supports all built-in activation strategies provided by Unleash.
201204

202205
Read more about
203206
[activation strategies in the official docs](https://docs.getunleash.io/reference/activation-strategies).
@@ -233,20 +236,19 @@ The initialize method takes the following arguments:
233236
- **strategies** - Custom activation strategies to be used.
234237
- **disableMetrics** - Disable metrics.
235238
- **customHeaders** - Provide a map(object) of custom headers to be sent to the unleash-server.
236-
- **customHeadersFunction** - Provide a function that return a Promise resolving as custom headers
239+
- **customHeadersFunction** - Provide a function that returns a Promise resolving as custom headers
237240
to be sent to unleash-server. When options are set, this will take precedence over `customHeaders`
238241
option.
239242
- **timeout** - Specify a timeout in milliseconds for outgoing HTTP requests. Defaults to 10000ms.
240243
- **repository** - Provide a custom repository implementation to manage the underlying data.
241-
- **httpOptions** - Provide custom http options such as `rejectUnauthorized` - be careful with these
244+
- **httpOptions** - Provide custom HTTP options such as `rejectUnauthorized` - be careful with these
242245
options as they may compromise your application security.
243246
- **namePrefix** - Only fetch feature toggles with the provided name prefix.
244-
- **tags** - Only fetch feature toggles tagged with the list of tags. E.g.:
245-
`[{type: 'simple', value: 'proxy'}]`.
247+
- **tags** - Only fetch feature toggles tagged with the list of tags, such as: `[{type: 'simple', value: 'proxy'}]`.
246248

247249
## Custom strategies
248250

249-
### 1. implement the custom strategy:
251+
### 1. Implement the custom strategy
250252

251253
```js
252254
import { initialize, Strategy } from 'unleash-client';
@@ -261,7 +263,7 @@ class ActiveForUserWithEmailStrategy extends Strategy {
261263
}
262264
```
263265

264-
### 2. register your custom strategy:
266+
### 2. Register your custom strategy
265267

266268
```js
267269
initialize({
@@ -281,13 +283,13 @@ The unleash instance object implements the EventEmitter class and **emits** the
281283
| ------------ | -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
282284
| ready | - | is emitted once the fs-cache is ready. if no cache file exists it will still be emitted. The client is ready to use, but might not have synchronized with the Unleash API yet. This means the SDK still can operate on stale configurations. |
283285
| synchronized | - | is emitted when the SDK has successfully synchronized with the Unleash API, or when it has been bootstrapped, and has all the latest feature toggle configuration available. |
284-
| registered | - | is emitted after the app has been registered at the api server |
286+
| registered | - | is emitted after the app has been registered at the API server |
285287
| sent | `object` data | key/value pair of delivered metrics |
286288
| count | `string` name, `boolean` enabled | is emitted when a feature is evaluated |
287289
| warn | `string` msg | is emitted on a warning |
288-
| error | `Error` err | is emitted on a error |
290+
| error | `Error` err | is emitted on an error |
289291
| unchanged | - | is emitted each time the client gets new toggle state from server, but nothing has changed |
290-
| changed | `object` data | is emitted each time the client gets new toggle state from server and changes has been made |
292+
| changed | `object` data | is emitted each time the client gets new toggle state from server and changes have been made |
291293
| impression | `object` data | is emitted for every user impression (isEnabled / getVariant) |
292294

293295
Example usage:
@@ -310,8 +312,8 @@ unleash.on('error', console.error);
310312
unleash.on('warn', console.warn);
311313

312314
unleash.once('registered', () => {
313-
// Do something after the client has registered with the server api.
314-
// NB! It might not have received updated feature toggles yet.
315+
// Do something after the client has registered with the server API.
316+
// Note: it might not have received updated feature toggles yet.
315317
});
316318

317319
unleash.once('changed', () => {
@@ -323,15 +325,15 @@ unleash.on('count', (name, enabled) => console.log(`isEnabled(${name})`));
323325

324326
## Bootstrap
325327

326-
(Available from v3.11.x)
328+
> Available from v3.11.x
327329
328330
The Node.js SDK supports a bootstrap parameter, allowing you to load the initial feature toggle
329331
configuration from somewhere else than the Unleash API. The bootstrap `data` can be provided as an
330-
argument directly to the SDK, as a `filePath` to load or as a `url` to fetch the content from.
332+
argument directly to the SDK, as a `filePath` to load, or as a `url` to fetch the content from.
331333
Bootstrap is a convenient way to increase resilience, where the SDK can still load fresh toggle
332334
configuration from the bootstrap location, even if the Unleash API should be unavailable at startup.
333335

334-
**1. Bootstrap with data passed as an argument**
336+
### 1. Bootstrap with data passed as an argument
335337

336338
```js
337339
const client = initialize({
@@ -355,7 +357,7 @@ const client = initialize({
355357
});
356358
```
357359

358-
**2. Bootstrap via a URL**
360+
### 2. Bootstrap via a URL
359361

360362
```js
361363
const client = initialize({
@@ -371,7 +373,7 @@ const client = initialize({
371373
});
372374
```
373375

374-
**3. Bootstrap from a File**
376+
### 3. Bootstrap from a file
375377

376378
```js
377379
const client = initialize({
@@ -406,16 +408,16 @@ const featureToggleX = getFeatureToggleDefinition('app.ToggleX');
406408
const featureToggles = getFeatureToggleDefinitions();
407409
```
408410

409-
## Custom Store Provider
411+
## Custom store provider
410412

411413
(Available from v3.11.x)
412414

413-
By default this SDK will use a store provider that writes a backup of the feature toggle
415+
By default, this SDK will use a store provider that writes a backup of the feature toggle
414416
configuration to a **file on disk**. This happens every time it receives updated configuration from
415417
the Unleash API. You can swap out the store provider with either the provided in-memory store
416418
provider or a custom store provider implemented by you.
417419

418-
**1. Use InMemStorageProvider**
420+
### 1. Use `InMemStorageProvider`
419421

420422
```js
421423
import { initialize, InMemStorageProvider } from 'unleash-client';
@@ -428,7 +430,7 @@ const client = initialize({
428430
});
429431
```
430432

431-
**2. Custom Store Provider backed by redis**
433+
### 2. Custom store provider backed by Redis
432434

433435
```js
434436
import { initialize, InMemStorageProvider } from 'unleash-client';
@@ -461,17 +463,17 @@ const client = initialize({
461463

462464
## Custom repository
463465

464-
You can manage the underlying data layer yourself if you want to. This enables you to use unleash
465-
offline, from a browser environment or implement your own caching layer. See
466+
You can manage the underlying data layer yourself if you want to. This enables you to use Unleash
467+
offline, from a browser environment, or by implement your own caching layer. See
466468
[example](examples/custom_repository.js).
467469

468470
Unleash depends on a `ready` event of the repository you pass in. Be sure that you emit the event
469-
**after** you've initialized unleash.
471+
**after** you've initialized Unleash.
470472

471473
## Usage with HTTP and HTTPS proxies
472474

473475
You can connect to the Unleash API through the corporate proxy by setting one of the environment
474-
variables: `HTTP_PROXY` or `HTTPS_PROXY`
476+
variables: `HTTP_PROXY` or `HTTPS_PROXY`.
475477

476478
## Design philosophy
477479

0 commit comments

Comments
 (0)