Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kasperlewau/koa-h2-man-pusher

server push middleware for koa w/ manifest support
https://github.com/kasperlewau/koa-h2-man-pusher

http2 http2-push koa koa-middleware server-push

Last synced: 13 days ago
JSON representation

server push middleware for koa w/ manifest support

Awesome Lists containing this project

README

        

# koa-h2-man-pusher
> server push middleware for koa w/ manifest support

## Note: This is an unstable WIP. Don't go prod.
> also holds true for the readme. it is very sparse right now.

## Installation

```sh
npm install koa-h2-man-pusher --save
```

## API

### manpusher([opts])
### opts.root
Type: `string`

Default: `.`

Root path to read from.

### opts.manifest
Type: `string`

Default: `push_manifest.json`

Path to your [http2-push-manifest]().

## Usage
```js
const spdy = require('spdy');
const Koa = require('koa');
const manpusher = require('koa-h2-man-pusher');

const app = new Koa();

app.use(manpusher({
manifest: 'stuff/manifest.json',
root: 'dist'
}));

const server = spdy.createServer({
key: 'path/to/ssl.key',
cert: 'path/to/ssl.crt'
}, app.callback());

server.listen(3000);
```

## Copyright
MIT