# koa-server-push

> HTTP2 push middleware for koa

Latest version **0.1.0** (published 2015-12-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install koa-server-push
pnpm add koa-server-push
yarn add koa-server-push
bun add koa-server-push
```

## 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.0 |
| Published | 2015-12-01 |
| First published | 2015-12-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 24 |
| Author | Alexander Klein |
| Maintainers | silenceisgolden |
| Keywords | koa, middleware, manifest, server, push |

## Links

- npm: https://www.npmjs.com/package/koa-server-push
- Repository: https://github.com/silenceisgolden/koa-server-push
- Homepage: https://github.com/silenceisgolden/koa-server-push#readme
- Issues: https://github.com/silenceisgolden/koa-server-push/issues
- npm.io page: https://npm.io/package/koa-server-push

## Dependencies (3)

- [mz](https://npm.io/package/mz.md) ^2.1.0
- [chalk](https://npm.io/package/chalk.md) ^1.1.1
- [debug](https://npm.io/package/debug.md) ^2.2.0

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2015-12-01
- 0.0.8 (dev) — 2015-12-01
- 0.0.7 — 2015-12-01
- 0.0.6 — 2015-12-01
- 0.0.5 — 2015-12-01
- 0.0.4 — 2015-12-01
- 0.0.3 — 2015-12-01
- 0.0.2 — 2015-12-01
- 0.0.1 — 2015-12-01

## README

# koa-server-push
HTTP2 Server Push middleware for Koa

## Installation
```bash
$ npm install koa-server-push
```

## API
Usage for Koa 2.x (current version of node)
```js
const Koa = require('koa');
const serverpush = require('koa-server-push');
const app = new Koa();

app.use(serverpush());
// OR
// app.use(serverpush({
//   manifestName: 'anothername.json',
//   gaeproxy: true,
//   singleheader: true
// }));
```

## Options (optional)
- `manifestName` The name of the manifest files. Defaults to `'push_manifest.json'`.
- `gaeproxy` Set the `X-Associated-Content` header as well. Defaults to `false`.
- `singleheader` Set the `Link` header as a comma separated string instead of multiple `Link` headers. Defaults to `false`.

## Example
```js
'use strict';

const Koa = require('koa');
const serve = require('koa-static');
const convert = require('koa-convert');
const serverpush = require('koa-server-push');

const app = new Koa();

app.use(serverpush());
// OR
// app.use(serverpush({
//   manifestName: 'anothername.json',
//   gaeproxy: true,
//   singleheader: true
// }));
app.use(convert(serve('test/fixtures')));

/**
 * Note:
 * Please ensure that the server push middleware is not used after the
 * middleware that sets the response body and response type. This use case is
 * not supported at this time.
 */

app.listen(3000);
```

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