title: Hapi,js - Proper way to include a plugin inside a plugin
body: <p>I have this Hapi.js server that requires 2 endpoints to do Basic auth(using the hapi-auth-basic module). Each endpoints logic for checking the "username/password" is different, so i've broken these 2 things into their own plugins.</p>
  
  <p>Currently this is how i am registering the the plugins: </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>...
  
  server.register([Basic,
  ...
      require('./auth/register-device'),
      require('./auth/sender'),
  ...
  ], (err) =&gt; {
   ....
   </code></pre>
  </div>
  </div>
  </p>
  
  <p>While this works, i have to make sure that the Basic plugin is also being registered.  </p>
  
  <p>I tried to register the Basic plugin in my plugins register method here(which i've removed and moved to the above file):</p>
  
  <p><a href="https://github.com/salty-pig/Salty-Pig/blob/master/auth/sender.js#L29" rel="nofollow">https://github.com/salty-pig/Salty-Pig/blob/master/auth/sender.js#L29</a> , but when i did that for both plugins, i got the error that the Basic plugin was already registered.</p>
  
  <p>I guess i'm wondering what the best practice here should be.  In my case, this works since i'm not distributing these "auth" plugins.</p>
  
  <p>Question 2 would be: If i had a plugin that i wanted to make into a npm module, that needed to include another plugin, what are the best practices for that.  </p>
  
  <p>thanks</p>