fastify-server-version
v1.0.1
Published
A Fastify plugin to add server version and last commit to respose header
Downloads
7
Readme
Fastify Server Version
A Fastify plugin to add server version and last commit to respose header
Install
> npm install --save fastify-server-version
Usage
const Fastify = require('fastify')
const serverVersion = require('fastify-server-version')
const fastify = Fastify()
fastify.register(serverVersion())
fastify.get('/', (request, reply) => {
reply.send({ hello: 'world' })
// Response headers[x-server-version] = 8.8.8
// Response headers[x-commit-hash] = abc7878dvee0920ijdksdks
})
API
serverVersion([, pluginOpts])
versionHeaderName
(String) = version header name. Default:x-server-version
commitHeaderName
(String) = last commit hash header name. Default:x-commit-hash
isExposeLastCommit
(Boolean) = send last commit hash header in response. Default:true
isExposeVersion
(Boolean) = send server version header in response. Default:true
lastCommitHash
(String) = last commit hash. Default: will be taken from environment variableLAST_COMMIT_HASH
, if not found will be taken fromgit
version
(String) = server version. Default: will be taken from package.json file in the current working directory.isThrowOnErrors
(Boolean) = throw error on strat if module fail while trying to guess version and hash. Default:false