UNPKG

1.33 kBMarkdownView Raw
1[![Build Status](https://travis-ci.org/GreetzNL/abby-client.svg?branch=master)](https://travis-ci.org/GreetzNL/abby-client)
2[![Coverage Status](https://coveralls.io/repos/github/GreetzNL/abby-client/badge.svg)](https://coveralls.io/github/GreetzNL/abby-client)
3
4# Abby client
5
6This is the client library for Greetz's very own A/B testing platform.
7
8## Usage
9
10First you need to init the module to be able to fetch all active experiment.
11
12`const abbyClient = require('abby-client')({ apiEndpoint, tags, logger }, synchroniser);`
13
14### Config
15
16`apiEndpoint` - String: absolute address of API endpoint
17
18`tags` - String: meta info like name of current envouriment
19
20`logger` - Class|Object: logger object which will replace default logger. Note that it should support `log`, `debug`, and `error` methods. By default it will use `console`.
21
22`interval` - Number: amount of milliseconds before calling api for experiments. Default 1 minute (60000ms)
23### Synchroniser
24*TODO*:
25`synchroniser` - Class|Object: synchroniser object.
26
27to start fetching you need to run
28
29`abbyClient.ready()`
30
31and then you are ready to use it. Just pass your request and response objects and abby-client will set appropirate experiments to response object.
32
33`abbyClient(req, res)`
34
35## Test
36Run `npm test` to start tests. It will automatically generate coverage.