How to use the koa/package.json.version function in koa

To help you get started, we’ve selected a few koa examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github simov / grant / test / consumer / util / client.js View on Github external
Koa = function () {
  var version = parseInt(require('koa/package.json').version.split('.')[0])

  var app = new _Koa()

  if (version >= 2) {
    var _use = app.use
    app.use = (mw) => _use.call(app, convert(mw))
  }

  return app
}
github simov / grant / test / consumer / error.js View on Github external
Koa = function () {
  var version = parseInt(require('koa/package.json').version.split('.')[0])

  var app = new _Koa()

  if (version >= 2) {
    var _use = app.use
    app.use = (mw) => _use.call(app, convert(mw))
  }

  return app
}
var hapi = parseInt(require('hapi/package.json').version.split('.')[0])
github simov / grant / test / consumer / koa / error.js View on Github external
Koa = function () {
  var version = parseInt(require('koa/package.json').version.split('.')[0])

  var app = new _Koa()

  if (version >= 2) {
    var _use = app.use
    app.use = (mw) => _use.call(app, convert(mw))
  }

  return app
}
github simov / grant / test / consumer / koa / flow.js View on Github external
Koa = function () {
  var version = parseInt(require('koa/package.json').version.split('.')[0])

  var app = new _Koa()

  if (version >= 2) {
    var _use = app.use
    app.use = (mw) => _use.call(app, convert(mw))
  }

  return app
}
github JounQin / vue-ssr / server / index.js View on Github external
: fs.readFileSync(resolve('dist/template.html'), 'utf-8')

const app = new Koa()

app
  .use(compress())
  .use(logger())
  .use(serve(resolve('public')))

router(app)

let renderer
let readyPromise
let mfs

const koaVersion = require('koa/package.json').version
const vueVersion = require('vue-server-renderer/package.json').version

const INDEX_PAGE = '__non-ssr-page__.html'

const DEFAULT_HEADERS = {
  'Content-Type': 'text/html',
  Server: `koa/${koaVersion}; vue-server-renderer/${vueVersion}`,
}

const NON_SSR_PATTERN = ['/test']
const STATIC_PATTERN = ['/', '/articles', '/article/:id(\\d+)']

app.use(async (ctx, next) => {
  await readyPromise

  if (

koa

Koa web app framework

MIT
Latest version published 8 months ago

Package Health Score

94 / 100
Full package analysis