# reactive-http

> > HTTP [`Fetch` API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) client over [RxJS `Observables`](https://rxjs.dev/guide/overview) inspired by [Angular `HttpClient`](https://angular.io/api/common/http/HttpClient).

Latest version **0.1.1** (published 2023-03-24) · MIT license · 0 weekly downloads

## Install

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

## Health

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

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2023-03-24 |
| First published | 2023-03-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 23.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jose Quintana |
| Maintainers | joseluisq |
| Keywords | fetch, http, request, Rx, RxJS, ReactiveX, client, xhr, ES2015 |

## Links

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

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2023-03-24
- 0.0.6 — 2023-03-24
- 0.0.5 — 2023-03-24
- 0.0.4 — 2023-03-24
- 0.0.3 — 2023-03-19
- 0.0.2 — 2023-03-19
- 0.0.1 — 2023-03-17
- 0.0.0 — 2023-03-15

## README

# Reactive HTTP ![devel](https://github.com/joseluisq/reactive-http/workflows/devel/badge.svg?branch=master) [![npm](https://img.shields.io/npm/v/reactive-http.svg)](https://www.npmjs.com/package/reactive-http) [![npm](https://img.shields.io/npm/dt/reactive-http.svg)](https://www.npmjs.com/package/reactive-http) [![docs](https://img.shields.io/badge/docs-latest-green)](https://joseluisq.github.io/reactive-http/)

> HTTP [`Fetch` API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) client over [RxJS `Observables`](https://rxjs.dev/guide/overview) inspired by [Angular `HttpClient`](https://angular.io/api/common/http/HttpClient).

## Install

```sh
npm install rxjs@^7 reactive-http --save
# or
yarn add rxjs@^7 reactive-http
```

## Usage

```ts
// import { catchError, of } from 'rxjs'
import { Observable } from 'rxjs'
import { Http, HttpHandler, HttpInterceptor } from 'reactive-http'

class Interceptor1 implements HttpInterceptor {
    intercept(req: Request, next: HttpHandler): Observable<Response> {
        console.log("first interceptor!")
        return next(req)
    }
}

class Interceptor2 implements HttpInterceptor {
    intercept(req: Request, next: HttpHandler): Observable<Response> {
        console.log("second interceptor!")
        return next(req)
    }
}

interface Repository {
    id: number,
    name: string,
    description: string,
    html_url: string,
}

const http = new Http()
http.intercept(new Interceptor1())
http.intercept(new Interceptor2())

const ob$ = http.get<Repository>('https://api.github.com/repos/joseluisq/reactive-http')
// .pipe(
//     catchError(err => {
//         console.error(err)
//         return of({ error: false, message: err.message })
//     })
// )

ob$.subscribe(resp => {
    console.log('id:', resp.id)
    console.log('name:', resp.name)
    console.log('description:', resp.description)
})
```

## API

See [reactive-http documentation](https://joseluisq.github.io/reactive-http/) page.

## Contributions

Feel free to send a [Pull request](https://github.com/joseluisq/reactive-http/pulls) or file an [issue](https://github.com/joseluisq/reactive-http/issues).

## License
MIT license

© 2023-present [Jose Quintana](https://github.com/joseluisq)

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