@tng/version

1.2.5 • Public • Published

version

add /version api for server

install

yarn add @tng/version

usage

// for toa koa2 express
const versionMw = require('@tng/version')
app.use(versionMw())
// for koa1
const versionMw = require('@tng/version')
app.use(versionMw.koa1())

// custom route
const versionMw = require('@tng/version')
app.use(versionMw.koa1('/api/version'))

API:getVersion

const versionMw = require('@tng/version')
versionMw.getVersion()
=>
{
  name: pkg.name,
  version: pkg.version,
  startTime: 服务启动时间,
  buildTime: process.env.BUILD_TIME,
  buildCommit: process.env.BUILD_COMMIT
}

/version

{
  name: pkg.name,
  version: pkg.version,
  startTime: 服务启动时间,
  buildTime: process.env.BUILD_TIME,
  buildCommit: process.env.BUILD_COMMIT
}

test

npm test

Readme

Keywords

Package Sidebar

Install

npm i @tng/version

Weekly Downloads

2

Version

1.2.5

License

MIT

Unpacked Size

61 kB

Total Files

12

Last publish

Collaborators

  • aerohui
  • isayme
  • orangemi