# @fabernovel/heart-api

> Runner module of Heart, which exposes an API that starts an analysis when it is requested

Latest version **4.0.0** (published 2023-10-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install @fabernovel/heart-api
pnpm add @fabernovel/heart-api
yarn add @fabernovel/heart-api
bun add @fabernovel/heart-api
```

## Health

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

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2023-10-08 |
| First published | 2019-06-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18 <21 |
| Dependencies | 5 |
| Unpacked size | 9.7 KB |
| Known vulnerabilities | 0 (+9 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 6 |
| Maintainers | thomasgiscos, gautierb, williamgoulois, cezarion, bastien.gatellier.fabernovel, arnaud.mombrial.npmjs, victorchabbert |

## Links

- npm: https://www.npmjs.com/package/@fabernovel/heart-api
- Repository: https://github.com/faberNovel/heart
- Homepage: https://heart.fabernovel.com
- Issues: https://github.com/faberNovel/heart/issues
- npm.io page: https://npm.io/package/@fabernovel/heart-api

## Dependencies (5)

- [ajv](https://npm.io/package/ajv.md) ^8.12.0
- [fastify](https://npm.io/package/fastify.md) ^4.23.2
- [ajv-errors](https://npm.io/package/ajv-errors.md) ^3.0.0
- [@fastify/cors](https://npm.io/package/@fastify/cors.md) ^8.4.0
- [@fabernovel/heart-common](https://npm.io/package/@fabernovel/heart-common.md) ^4.0.0

## Recent versions

- 4.0.0 (latest) — 2023-10-08
- 4.0.0-alpha.9 — 2023-07-31
- 4.0.0-alpha.8 — 2023-07-30
- 4.0.0-alpha.7 — 2023-07-30
- 4.0.0-alpha.6 — 2023-07-17
- 4.0.0-alpha.5 — 2023-06-04
- 4.0.0-alpha.4 — 2023-04-26
- 4.0.0-alpha.3 — 2023-04-01
- 3.2.0 — 2022-11-23
- 3.1.1 — 2022-07-28
- 3.1.0 — 2020-01-16
- 3.0.1 — 2019-07-19
- 1.0.1 — 2019-07-15
- 1.0.0 — 2019-06-11

## README

# Description

_Heart API_ is a _runner_ module of _Heart_, which exposes an HTTP API that starts an analysis when it is requested.

Note that you must install an _analysis_ module too, to have a minimum viable installation of _Heart_.

Read more about [the description and design of _Heart_](https://github.com/faberNovel/heart#readme).

# Usage

1. Install the package and an _analysis_ module, for example _[Heart GreenIT](https://www.npmjs.com/package/@fabernovel/heart-greenit)_

    ```bash
    npm install @fabernovel/heart-api @fabernovel/heart-greenit
    ```

    If you are using Yarn, npm < 7 or PNPM < 8, you also have to install _[Heart CLI](https://www.npmjs.com/package/@fabernovel/heart-cli)_ (which is automatically installed in more recent versions of these packages managers):

    ```bash
    npm install @fabernovel/heart-cli
    ```

2. Start the server

    ```bash
    npx heart api
    ```

    You now have an HTTP server listening to `127.0.0.1:3000`, with a `/greenit` endpoint where you could `POST` your analysis configuration (JSON-formatted) to start an analysis.

    You can change the default port with the `--port` option, and specify HTTP CORS headers with the `--cors` one.

3. Start an analysis

    ```http
    POST /greenit
    Content-type: application/json
    {
      "config": {
        "url": "https://www.fabernovel.com"
      }
    }
    ```

    The analysis configuration set with the request's body follows the JSON format, and depends of the analysis module; read their README.

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