# the-http

> A toolkit to help build HTTP service.

Latest version **1.0.0** (published 2018-02-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install the-http
pnpm add the-http
yarn add the-http
bun add the-http
```

## 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.0 |
| Published | 2018-02-13 |
| First published | 2018-02-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 45.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | zhaoyao91 |
| Maintainers | zhaoyao91 |
| Keywords | http, micro service |

## Links

- npm: https://www.npmjs.com/package/the-http
- Repository: https://github.com/zhaoyao91/the-http
- Homepage: https://github.com/zhaoyao91/the-http#readme
- Issues: https://github.com/zhaoyao91/the-http/issues
- npm.io page: https://npm.io/package/the-http

## Dependencies (3)

- [raw-body](https://npm.io/package/raw-body.md) ^2.3.2
- [is-stream](https://npm.io/package/is-stream.md) ^1.1.0
- [http-status](https://npm.io/package/http-status.md) ^1.0.1

## Recent versions

- 1.0.0 (latest) — 2018-02-13
- 0.3.2 — 2018-02-12
- 0.3.1 — 2018-02-11
- 0.3.0 — 2018-02-10
- 0.2.0 — 2018-02-02
- 0.1.1 — 2018-02-01
- 0.1.0 — 2018-02-01

## README

# The HTTP (TH)

A toolkit to help build HTTP service.

## Features

- **Modern**: Using `async/await` instead of `callback`
- **Simple**: Simple function model: `async (request) => response`
- **Extensible**: Via making and composing intuitive wrappers
- **Standard**: Just HTTP
- **Micro**: Suitable for micro service

## Categories

- [Motivation](./docs/motivation.md)
- [Install](#install)
- [Getting Started](#getting-started)
- [API](./docs/api.md)

## Install

```
npm i --save the-http
```

## Getting Started

```ecmascript 6
const {Response, compose, handleErrors, listen} = require('the-http') 

async function handler(request) {
  const {name, age} = await request.body.asJSON()
  return Response.withJSONBody({
    isAdult: age >= 18,
    message: `Hello ${name}`
  })
}

const enhancedHandler = compose(
  handleErrors()
)(handler)

listen(3000)(enhancedHandler)
```

See [RequestBody](./docs/api.md#requestbody), [Request](./docs/api.md#request), [Response](./docs/api.md#response) and more in [API doc](./docs/api.md).

## License

MIT

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