process-title-plugin
v2.0.2
Published
A hapi plugin that sets your applications process.title to the name within your projects package.json
Downloads
2
Maintainers
Readme
About process-title-plugin
A hapi plugin that sets the process.title of your hapi application to the name defined within your project's package.json file. Optional overrides exist for overriding the name defined within the package.json file (nameOverride). Version 2.0.1 of this plugin has been tested with v17 and v18 of Hapi but if you are committed to running Hapi v16 then checkout the 1.0.0 version of this plugin.
Install
npm install process-title-plugin --save
Usage:
'use strict';
const Hapi = require('@hapi/hapi');
const processTitlePlugin = require('process-title-plugin');
const Path = require('path');
const server = new Hapi.Server({
host: 'localhost',
port: 3000
});
const startup = async () => {
await server.register([{
plugin: processTitlePlugin,
options: {
packageFileLocation: Path.join(__dirname, './', 'package.json')
}
}]);
await server.start();
};
startup().catch((err) => {
throw err;
});
console.log(`${new Date()}: server running at ${server.info.uri}`);
Usage using plugin option for name override:
'use strict';
const Hapi = require('@hapi/hapi');
const processTitlePlugin = require('process-title-plugin');
const Path = require('path');
const server = new Hapi.Server({
host: 'localhost',
port: 3000
});
const startup = async () => {
await server.register([{
plugin: processTitlePlugin,
options: {
packageFileLocation: Path.join(__dirname, './', 'package.json')
nameOverride: 'myCustApp'
}
}]);
await server.start();
};
startup().catch((err) => {
throw err;
});
console.log(`${new Date()}: server running at ${server.info.uri}`);