hapijs / glue

Server composer for hapi.js
Other
245 stars 62 forks source link

registrations documentation #63

Closed danielb2 closed 8 years ago

danielb2 commented 8 years ago

For the registrations array, reading the documentation:

screen shot 2016-02-12 at 10 17 49

It reads like the format is:

{
registrations: [{
    plugin: 'pluginname',
    options: {}
}]
}

however, according to the example, it reads:

{
registrations: [{
    plugin: {
        register: 'pluginname',
        options: {}
   },
}]
}

Since it appears that both formats work, is one deprecated?

Regarding the example format, it seems to me that it is redundant to say plugin or is there something else that can be registered?

csrl commented 8 years ago

No, they are both valid. And have two different meanings. Whatever you can pass to the server.register function, you can put into the configuration. Here is the full expanded example:

{
  registrations: [
    {
      plugin: {
        register: 'pluginname',
        options: {}
      },
      options: {}
    }
  ]
}

The first options is the plugin options (eg. the options passed to the plugin). The second is the registration options (eg. the 2nd parameter to server.register())

danielb2 commented 8 years ago

My point here was that both options don't appear to be described in the documentation. Or did I miss one?

csrl commented 8 years ago

The documentation for the registrations array is such:

It doesn't explicitly document the registration plugin value, as that is defined by hapi. I see no reason to duplicate hapi's documentation. Same goes for registration option value. There is a link to the hapi registration function api documentation for reference.

However, you aren't the first to express that the doc is unclear. I'm open to a pull request, but I'd like to not duplicate hapi's documentation. The form glue has currently taken is to be as transparent of a wrapper to the hapi api as possible. You have to understand hapi api in order to create a glue manifest.

lock[bot] commented 4 years ago

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.