# @robelberhe/requester

> a very lightweight promise based http client, built to access json based api's and easy to use and dependency free.

Latest version **1.1.3** (published 2019-07-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install @robelberhe/requester
pnpm add @robelberhe/requester
yarn add @robelberhe/requester
bun add @robelberhe/requester
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.3 |
| Published | 2019-07-12 |
| First published | 2019-07-11 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Robel Berhe |
| Maintainers | robelberhe |
| Keywords | ["http, client", "request", "http, requester", "request, api"] |

## Links

- npm: https://www.npmjs.com/package/@robelberhe/requester
- npm.io page: https://npm.io/package/@robelberhe/requester

## 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

- 1.1.3 (latest) — 2019-07-12
- 1.1.2 — 2019-07-12
- 1.1.1 — 2019-07-12
- 1.0.0 — 2019-07-11

## README

# Server side http client
Requester is a server side http client, used to make api calls from your own or third party api's.
Requester is a **easy**, **lightweight**, **minimal** http client with **0 dependencies**.
you can use it in NodeJs applications.

# @robelberhe/requester

![npm (scoped)](https://img.shields.io/badge/http--requester-1.1.3-blue.svg)

(https://github.com/RobiBerhe/server-side-http-client)

## installation
```
npm install @robelberhe/requster
```

## Examples (http get requests)
here is an example which show how to send an http get request using **requester**

``` js
const requester = require('@robelberhe/requester');

requester.get("http://yoursite.com/api/endpoint")
          .then((res)=>{
              console.log("Data Retrieved...");
              console.log(res.body);
          }).catch((error)=>{
              console.log("There seems to be some problem accessing the resource");
              console.log(error.message);
              // you can also get whatever the server may have sent instead by accessing error.data.
              // console.log(error.data);
          });
```
## Examples (http post requests)
``` js
const requester = require('@robelberhe/requester');
requester.post("http://yoursite.com/endpoint",{userID:1})
.then((res)=>{
   console.log(`status code: ${res.statusCode}`);
   console.log("Data : ");
   console.log(res.body);
}).catch((error)=>{
    console.log(error);
    // or error.data.
});

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