# nast-api

> Library for building api requests.

Latest version **1.0.31** (published 2021-11-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install nast-api
pnpm add nast-api
yarn add nast-api
bun add nast-api
```

## 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.0.31 |
| Published | 2021-11-10 |
| First published | 2021-07-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 19 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Alexey |
| Maintainers | alexey-renova |
| Keywords | request, api, axios, xhr, http, ajax, promise, node |

## Links

- npm: https://www.npmjs.com/package/nast-api
- Repository: https://github.com/renova-st/nast
- Homepage: https://github.com/renova-st/nast#readme
- Issues: https://github.com/renova-st/nast/issues
- npm.io page: https://npm.io/package/nast-api

## Dependencies (3)

- [nast](https://npm.io/package/nast.md) ^1.0.*
- [axios](https://npm.io/package/axios.md) ^0.21.*
- [lodash](https://npm.io/package/lodash.md) ^4.17.*

## 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.0.31 (latest) — 2021-11-10
- 1.0.30 — 2021-09-12
- 1.0.29 — 2021-08-05
- 1.0.28 — 2021-07-27
- 1.0.27 — 2021-07-27
- 1.0.26 — 2021-07-27
- 1.0.25 — 2021-07-27
- 1.0.24 — 2021-07-27
- 1.0.23 — 2021-07-27
- 1.0.22 — 2021-07-11
- 1.0.21 — 2021-07-11
- 1.0.20 — 2021-07-11
- 1.0.19 — 2021-07-11
- 1.0.18 — 2021-07-11
- 1.0.17 — 2021-07-11
- … 16 more at https://npm.io/package/nast-api/versions

## README

# nast-api

## Installation
```
npm i -S nast-api</code></pre>
```

## Basic usage
```
import Api, { RequestBuilder, } from 'nast-api'

const api = new Api(RequestBuilder, {})

api.get('localhost/api/users').then((request) => {
  //
})
```

## Config
```
const api = new Api(RequestBuilder, {
  servers: {
    default: 'http://127.0.0.1:8000/api/',
  },
  then: (r) => r,
  catch: (r) => {
    throw r
  },
  finally: () => {},
})
```

## Example
```
api.get('users')
  .page(2)
  .size(20)
  .v(2)
  .sort('id,desc')
  .filter({ authorId: 1, })
  .with('posts', (q) => q
    .sort('id,desc')
    .filter({ authorId: 1, })
    .with('comments', (q) => q
      .sort('id,desc')
      .filter({ authorId: 1, })))
  .then((response) => {
    console.log(response)
  }).catch((error) => {
    console.log(e)
  })
```

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