1.0.0 • Published 6 years ago

99voices_npm_tyk_client v1.0.0

Weekly downloads
15
License
MIT
Repository
github
Last release
6 years ago

Tyk Client

This package contains a client for the tyk service.

Development

This package is developed within a docker container. Run scripts/run.sh to obtain the development environment. Run every yarn operation through the container like docker exec -it ${container_id} yarn .... The container watches for file changes on the sources and automatically rebuilds the distribution code. Before running yarn publish be sure to run yarn login.

Usage

This package contains and returns a singleton. Meaning that you can require the file wherever you want to, and you will always obtain the same client instance. In order for this to work it is vital that the client instance is first initialized. This is done like this:

import Config from '99voices_npm_config';
import Client from '99voices_npm_tyk_client';

let config = Config();

const client = Client({config});

API

registerSwaggerApi({api, options})

Registers an api at tyk based on the provided swagger file. It takes care of making public stuff public, and private stuff private. It also hot-reloads tyk immediately afterwards to have the changes applied immediately. Returns a promise.