A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/koajs/conditional-get below:

koajs/conditional-get: Conditional GET middleware for koa

Conditional GET support for koa.

# npm
$ npm install koa-conditional-get
# yarn
$ yarn add koa-conditional-get
const conditional = require('koa-conditional-get');
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')
)

MIT


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4