# 200-ok-boomer

> Middleware to convert "200 OK" into "200 OK Boomer"

Latest version **2.1.0** (published 2020-06-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install 200-ok-boomer
pnpm add 200-ok-boomer
yarn add 200-ok-boomer
bun add 200-ok-boomer
```

## 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 | 2.1.0 |
| Published | 2020-06-23 |
| First published | 2019-12-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 38.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Matthew Preble |
| Maintainers | mbpreble |
| Keywords | silly |

## Links

- npm: https://www.npmjs.com/package/200-ok-boomer
- Repository: https://github.com/mbpreble/200-ok-boomer
- Homepage: https://github.com/mbpreble/200-ok-boomer#readme
- Issues: https://github.com/mbpreble/200-ok-boomer/issues
- npm.io page: https://npm.io/package/200-ok-boomer

## Dependencies (1)

- [codecov](https://npm.io/package/codecov.md) ^3.6.5

## Recent versions

- 2.1.0 (latest) — 2020-06-23
- 2.0.0 — 2020-02-17
- 1.0.1 — 2019-12-23
- 1.0.0 — 2019-12-23

## README

![npm](https://img.shields.io/npm/v/200-ok-boomer)
![Codecov](https://img.shields.io/codecov/c/github/mbpreble/200-ok-boomer)

# 200-ok-boomer
Middleware to convert "200 OK" into "200 OK Boomer"

This project shouldn't be taken seriously or in any way as a political statement.
It *only* provides a single function okBoomer which has the signature of Express Middleware 
`function okBoomer(req, res, next)`

This middleware overwrites the `send` method of the request to transmit a `statusMessage` of "OK Boomer" along
as long as `statusCode` is 200. That's it, that's all it does.

In order to work properly this middleware should be registered before request handlers or anything else which can 
transmit headers to clients since it replaces methods on the `Response` object at the time it is invoked as middleware.

# Usage
In the case of an Express app, simply require `200-ok-boomer` and apply as middleware
e.g. 
```
const express = require('express');
const okBoomer = require('200-ok-boomer');

const app = express();
app.use(okBoomer());
app.get('/', (req, res) => res.sendStatus(200));
server = app.listen(5000);
```

```
$curl -I localhost:5000
HTTP/1.1 200 OK Boomer
```

# Telemetry
As of version 2.0.0, 200-ok-boomer will by default emit simple metrics (a count of 200 OK Boomer responses).
This will be done by periodically (once per minute) calling a metrics endpoint with an aggregated count.

If this behavior is undesirable, please pass a configuration object specifying "collectMetrics" to be false:
```
app.use(okBoomer()); // Will collect and transmit metrics
app.use(okBoomer({collectMetrics: false})); // Will NOT collect and transmit metrics
```

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