plugo

Dynamically expose hapi plugins from a given path

Usage no npm install needed!

<script type="module">
  import plugo from 'https://cdn.skypack.dev/plugo';
</script>

README

npm Build Status Dependencies Status DevDependencies Status

plugo

Dynamically expose modules to hapi plugins from a given path.

Usage

const Plugo = require('plugo');

exports.register = (plugin, options, next) => {
  var plugoptions = {
    name: 'handlers',
    path: __dirname + '/handlers'
  };
  
  // Exposes modules in the handlers folder to this plugin
  Plugo.expose(plugoptions, plugin, next);
};

exports.register.attributes = {
  name: 'controllers'
};

Options

The following options are available:

  • name: Defines property name under plugin [required]
  • path: Specifies which folder to load files [required]
  • extension: Specifies which file extension to look for (defaults to .js) [optional]