# Health routes

The health routes of games-api, with parameters, bodies, responses and request samples.

Generated from `openapi.yaml` of games-api 0.7.0: 3 routes.

- [`GET /healthz`](#get-healthz): Liveness, no dependency
- [`GET /api/health`](#get-api-health): Readiness, SELECT 1 and Redis PING
- [`GET /metrics`](#get-metrics): Prometheus metrics

<RouteHeading id="get-healthz" method="GET" path="/healthz" />

<CodePanel title="GET /healthz">
  <Fragment slot="curl">

    ```sh
    curl 'https://api.filudi.com/healthz'
    ```

  </Fragment>
  <Fragment slot="javascript">

    ```js
    const response = await fetch('https://api.filudi.com/healthz');
    const text = await response.text();
    ```

  </Fragment>
  <Fragment slot="python">

    ```py
    import requests

    response = requests.get('https://api.filudi.com/healthz')
    response.raise_for_status()
    text = response.text
    ```

  </Fragment>
</CodePanel>

**Liveness, no dependency**

Credential: none. The route is public.

### Responses

| Status | Body | Description |
| --- | --- | --- |
| 200 | `"ok"` (`text/plain`) | Process alive. |

<RouteHeading id="get-api-health" method="GET" path="/api/health" />

<CodePanel title="GET /api/health">
  <Fragment slot="curl">

    ```sh
    curl 'https://api.filudi.com/api/health'
    ```

  </Fragment>
  <Fragment slot="javascript">

    ```js
    const response = await fetch('https://api.filudi.com/api/health');
    const data = await response.json();
    ```

  </Fragment>
  <Fragment slot="python">

    ```py
    import requests

    response = requests.get('https://api.filudi.com/api/health')
    response.raise_for_status()
    data = response.json()
    ```

  </Fragment>
</CodePanel>

**Readiness, SELECT 1 and Redis PING**

Credential: none. The route is public.

### Responses

| Status | Body | Description |
| --- | --- | --- |
| 200 | object | Ready. |
| 503 | none | Database unreachable. |

**Body of 200**

| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `db` | `"ok"` | no |  |
| `redis` | one of `"ok"`, `"degraded"` | no |  |

<RouteHeading id="get-metrics" method="GET" path="/metrics" />

<CodePanel title="GET /metrics">
  <Fragment slot="curl">

    ```sh
    curl 'https://api.filudi.com/metrics'
    ```

  </Fragment>
  <Fragment slot="javascript">

    ```js
    const response = await fetch('https://api.filudi.com/metrics');
    const text = await response.text();
    ```

  </Fragment>
  <Fragment slot="python">

    ```py
    import requests

    response = requests.get('https://api.filudi.com/metrics')
    response.raise_for_status()
    text = response.text
    ```

  </Fragment>
</CodePanel>

**Prometheus metrics**

Credential: none. The route is public.

### Responses

| Status | Body | Description |
| --- | --- | --- |
| 200 | `text/plain` | Text exposition format. |
