# @arfedulov/koa-jsonapi-errors

> jsonapi error constructors and error handling middleware for koa

Latest version **0.1.2** (published 2019-11-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install @arfedulov/koa-jsonapi-errors
pnpm add @arfedulov/koa-jsonapi-errors
yarn add @arfedulov/koa-jsonapi-errors
bun add @arfedulov/koa-jsonapi-errors
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2019-11-09 |
| First published | 2019-10-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 40.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Artem Fedulov |
| Maintainers | arfedulov |
| Keywords | koa, middleware, jsonapi, errors |

## Links

- npm: https://www.npmjs.com/package/@arfedulov/koa-jsonapi-errors
- Repository: https://github.com/arfedulov/koa-jsonapi-errors
- Homepage: https://github.com/arfedulov/koa-jsonapi-errors#readme
- Issues: https://github.com/arfedulov/koa-jsonapi-errors/issues
- npm.io page: https://npm.io/package/@arfedulov/koa-jsonapi-errors

## Dependencies (2)

- [http-status-codes](https://npm.io/package/http-status-codes.md) ^1.4.0
- [jsonapi-typescript](https://npm.io/package/jsonapi-typescript.md) ^0.1.3

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.1.2 (latest) — 2019-11-09
- 0.1.1 — 2019-10-30
- 0.1.0 — 2019-10-30

## README

# koa-jsonapi-errors

Provides koa error handling middleware and a set of erro constructors that are used with this middleware.

## Installation

```
yarn add @arfedulov/koa-jsonapi-errors
```

## Usage

```ts
import Koa from 'koa';
import { jsonApiErrors, BadRequest } from '@arfedulov/koa-jsonapi-errors';

const app = new Koa();

app.use(jsonApiErrors);

app.use(async (ctx, next) => {
  throw new BadRequest();
});
/*
  Produce response body:
  {
    errors: [{ status: "400", title: "Bad request" }]
  }
*/

```

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