Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

tweek-client

1.0.0-rc7 • Public • Published

Tweek Client for JavaScript

Basic usage

Install the package

npm install --save tweek-client

Create a client:

const tweekClient = createTweekClient({
  baseServiceUrl: "https://mydomain",
});

Query your configuration key and get value

const myConfiguration = await tweekClient.fetch("/myconfiguration");

Updating Context

const myContext = {
  age: 23,
};
 
await tweekClient.appendContext("user", "123456", myContext);

Using Authentication

Example:

function getAuthenticationToken() {
  return 'jwt token';
}
 
const tweekClient = createTweekClient({
  baseServiceUrl: "https://mydomain",
  getAuthenticationToken,
});
 

getAuthenticationToken can also return a promise

function getAuthenticationToken() {
  return Promise.resolve('jwt token');
}
 
const tweekClient = createTweekClient({
  baseServiceUrl: "https://mydomain",
  getAuthenticationToken,
});
 

Keywords

none

install

npm i tweek-client

Downloadsweekly downloads

4,984

version

1.0.0-rc7

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability