Skip to content
This repository has been archived by the owner on Sep 18, 2019. It is now read-only.

Route Prefix with options Issue/Question #585

Closed
jberall opened this issue Nov 25, 2017 · 2 comments
Closed

Route Prefix with options Issue/Question #585

jberall opened this issue Nov 25, 2017 · 2 comments
Assignees
Labels

Comments

@jberall
Copy link

jberall commented Nov 25, 2017

I'm using Hapi 16.5.2, with Glue.
When I register my routes using the options either it rejects my options or does not register the prefix.
Not sure if same behavior in v17.
example
//route prefix works but can not pass options without error
{
plugin: './path-to-plugin.js',
options: {
routes: { prefix: '/api/transaction/1' }
// lob_id: 1
}
},
//route prefix does not work. But can pass options.
{
plugin: {
register: './routes/development/transaction-pleasurecraft.js',
options: {
routes: { prefix: '/api/transaction/1' },
lob_id: 1
}
}
},

Thanks,
Jonathan

@felixheck
Copy link

You have to split the options.

{
    plugin: {
        register: './routes/development/transaction-pleasurecraft.js',
        // optional options passed to the plugin during registration
        options: {
            lob_id: 1
        }
    },
    // optional registration options (different from the options passed to the registration function)
    options: {
        routes: {
            prefix: '/api/transaction/1'
        }
    }
}

See:

@WesTyler
Copy link

Discussed and resolved in the Glue issues as well, here. :)

@WesTyler WesTyler self-assigned this Nov 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants