process-title-plugin

2.0.2 • Public • Published

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.

Build Status

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}`);

Package Sidebar

Install

npm i process-title-plugin

Weekly Downloads

2

Version

2.0.2

License

MIT

Unpacked Size

9.35 kB

Total Files

9

Last publish

Collaborators

  • visualjeff