私信发送成功
Watch Star Fork

Cweili / koa-conditional-requestMIT

Conditional request support for koa.
克隆/下载
Cweili 最后提交于 2017-10-28 20:09 initial commit
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
2017-10-28 20:09
2017-10-28 20:09
2017-10-28 20:09
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 )

你可以在登录后,对此项目发表评论

4_float_left_people 4_float_left_close