@timetoogo/ff-client

1.0.0-20230205123242 • Public • Published

FF Proxy - Node Client

FF includes a client library for Node.js written in Typescript.

Installation

Install the latest prerelease version of @timetoogo/ff-client from NPM:

npm install --save @timetoogo/ff-client

See latest versions here

Usage

Using FfClient

The FfClient class provides the ability to send a HTTP request to an FF proxy:

const { FfClient } = require("@timetoogo/ff-client");

const client = new FfClient({
  ipAddress: "127.0.0.1",
  port: 8080,
  preSharedKey: 'mykey'
});

client.sendRequest({
  request: "GET / HTTP/1.1\nHost: www.google.com\n\n",
  https: true
});

Using FfClientAgent

If you have existing code that relies on the built-in http or https modules, the SDK provides a custom request agent to send requests to an FF proxy.

const http = require("http");
const { FfClientAgent } = require("@timetoogo/ff-client");

const agent = new FfClientAgent({
  ipAddress: "127.0.0.1",
  port: 8080,
  preSharedKey: 'mykey',
  mockResponse: 200
});

const request = http.request({
  method: "GET",
  path: "/",
  host: "www.google.com",
  agent
});

request.end();

Readme

Keywords

none

Package Sidebar

Install

npm i @timetoogo/ff-client

Weekly Downloads

0

Version

1.0.0-20230205123242

License

MIT

Unpacked Size

20.7 kB

Total Files

11

Last publish

Collaborators

  • timetoogo