# underflag-http

> http provider for underflag

Latest version **1.1.0** (published 2022-08-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install underflag-http
pnpm add underflag-http
yarn add underflag-http
bun add underflag-http
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2022-08-23 |
| First published | 2022-02-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 10.5 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Diego Souza |
| Maintainers | diego.souza |
| Keywords | feature flag, feature toggle, remote config, http |

## Links

- npm: https://www.npmjs.com/package/underflag-http
- Repository: https://github.com/dieg0s0uza/underflag-http
- Homepage: https://github.com/dieg0s0uza/underflag-http#readme
- Issues: https://github.com/dieg0s0uza/underflag-http/issues
- npm.io page: https://npm.io/package/underflag-http

## Dependencies (2)

- [axios](https://npm.io/package/axios.md) ^0.25.0
- [lodash.get](https://npm.io/package/lodash.get.md) ^4.4.2

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2022-08-23
- 1.0.6 — 2022-02-15
- 1.0.5 — 2022-02-09
- 1.0.4 — 2022-02-08
- 1.0.3 — 2022-02-07
- 1.0.2 — 2022-02-05

## README

# HTTP Provider

This is a HTTP provider for underflag (feature flag/feature toggle) than help your app to load the features from a json object or an array of json object from web. You can get easly from the Github json file, AWS S3 or a Rest API with custom token too. 

## Install

Using npm:

```bash
npm install underflag underflag-http
```

Using yarn:

```bash
yarn add underflag underflag-http
```

## How to use

Import the underflag and prepare to load data provider

```js
import { Underflag } from "underflag";
import { HttpDataProvider } from "underflag-http";

const dataProvider = new HttpDataProvider({ 
    url: 'http://localhost:3000/features' 
});
const underflag = new Underflag({ dataProvider });
if (await underflag.isOn("feature")) {
    // ...
}
```

_Important: The url need return a json object or an array of json object_

Eg. json object: 
```json
{
    "feature": true
}
```

Eg. array of json object: 
```json
[
    {
        "key": "feature",
        "value": true
    }
]
```

If you need getting data from nested field like:
```json
{
    "data": [
        {
            "key": "feature",
            "value": true
        }
    ]
}
```

You can setting the path of the field:
```js
const dataProvider = new HttpDataProvider({
    url: 'http://localhost:3000/features',
    nestedField: 'data'
});
```

The nestedField option use lodash.get, know more about lodash.get on https://lodash.com/docs#get

Know more on [underflag npm page](https://www.npmjs.com/package/underflag)

### License

[MIT](LICENSE)

---
_Source: https://npm.io/package/underflag-http · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
