Watch Star Fork

Cweili / koa-conditional-requestMIT

加入码云
与超过 200 万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
Conditional request support for koa.
Cweili 最后提交于 initial commit
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README.md 554 Bytes

Koa Conditional Request

Conditional request support for koa.

Install

Example

const conditional = require('koa-conditional-request');
const etag = require('koa-etag');
const Koa = require('koa');
const app = new Koa();

// use it upstream from etag so
// that they are present

app.use(conditional());

// add etags

app.use(etag());

// respond

app.use(async function(ctx, next){
  await next();

  ctx.body = {
    name: 'tobi',
    species: 'ferret',
    age: 2
  };
})

app.listen(3000);

console.log('listening on port 3000');

项目点评 ( 0 )

你可以在登录后,发表评论

5th_float_left_gitee 5th_float_left_close