0.2.2 • Published 7 years ago

koa-stream-render v0.2.2

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

Travis CI Status codecov.io

Installation

$ npm install koa@next @types/koa koa-stream-render --save

Introduction

This is a middleware for kao2 stream-render.

Broken Update

Use 'ctx.streamRender'(v0.2.0) instead of 'ctx.render'(v0.1.0)

Use 'StreamRenderContext'(v0.2.0) instead of 'RenderContext'(v0.1.0)

Example

import * as Koa from 'koa';
import { StreamRender, StreamRenderContext } from 'koa-stream-render';

const app = new Koa();

app.use(StreamRender({
  ctxType: 'html', // default
}));

app.use((ctx: StreamRenderContext, next: () => Promise<any>) => {
  ctx.streamRender('hello world');
  next();
});

app.listen(3000);
0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago