@tng/version
v1.2.5
Published
add /version api for server
Downloads
15
Readme
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