# myth-request

> Wraps a myth instance into an HTTP request handler

Latest version **1.0.3** (published 2014-12-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install myth-request
pnpm add myth-request
yarn add myth-request
bun add myth-request
```

## 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.3 |
| Published | 2014-12-20 |
| First published | 2014-12-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Maintainers | yoshuawuyts |
| Keywords | myth, http, response, buffer, cache |

## Links

- npm: https://www.npmjs.com/package/myth-request
- Repository: https://github.com/yoshuawuyts/myth-request
- Issues: https://github.com/yoshuawuyts/myth-request/issues
- npm.io page: https://npm.io/package/myth-request

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2014-12-20
- 1.0.2 — 2014-12-20
- 1.0.0 — 2014-12-20

## README

# myth-request
[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![Downloads][downloads-image]][downloads-url]

Wraps a [myth][myth] instance into an HTTP request handler, performing the
minimal amount of rebundling required and pausing requests mid-build to avoid
getting old versions of your script on reload.

## Installation
```bash
$ npm install myth-request
```

## Usage
```js
const mr     = require('myth-request')
const rework = require('rework')
const http   = require('http')
const myth   = require('myth')
const fs     = require('fs')

const css     = fs.readFileSync('index.css', 'utf8')
const handler = mr(rework(css).use(myth()))
const server  = http.createServer()

server.on('request', function(req, res) {
  handler(req, res, function(err, body) {
    if (err) console.log(err)
    res.end(body)
  })
})

server.listen(process.env.PORT || 1337)
```

## Why?
Setting up boilerplate for myth as an http handler can be a bit annoying. This
module provides a good entry point for both development and production servers
running myth. No `gulp`, `grunt` or `make` needed.

## See Also
- [watchify-request](https://github.com/hughsk/watchify-request)

## License
[MIT](https://tldrlegal.com/license/mit-license)

[npm-image]: https://img.shields.io/npm/v/myth-request.svg?style=flat-square
[npm-url]: https://npmjs.org/package/myth-request
[travis-image]: https://img.shields.io/travis/yoshuawuyts/myth-request.svg?style=flat-square
[travis-url]: https://travis-ci.org/yoshuawuyts/myth-request
[coveralls-image]: https://img.shields.io/coveralls/yoshuawuyts/myth-request.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/yoshuawuyts/myth-request?branch=master
[downloads-image]: http://img.shields.io/npm/dm/myth-request.svg?style=flat-square
[downloads-url]: https://npmjs.org/package/myth-request

[myth]: https://github.com/segmentio/myth

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