Skip to content

Added a custom route option to override whether pagination is on or off#7

Merged
fknop merged 1 commit intofknop:masterfrom
richardlay:controller-config-support
Dec 22, 2015
Merged

Added a custom route option to override whether pagination is on or off#7
fknop merged 1 commit intofknop:masterfrom
richardlay:controller-config-support

Conversation

@richardlay
Copy link
Copy Markdown

This allows you to configure if pagination is applied at the route definition using the hapi plugin options.

E.g.
config: {
plugins: {
pagination: { enabled: true }
},
handler: (request, reply) => reply([])
}

This overrides the global include/exclude array settings, and allows us not to care about actual paths.

@richardlay
Copy link
Copy Markdown
Author

We can also use the plugin options to override other options in the future, such as changing the name of the 'results' depending on the route. e.g. 'users' or 'accounts'.

@fknop
Copy link
Copy Markdown
Owner

fknop commented Dec 21, 2015

I think I'm gonna replace the following by route options

override: [{
                routes: [],
                limit: 25,
                page: 1
            }]

@fknop
Copy link
Copy Markdown
Owner

fknop commented Dec 21, 2015

I will need more time for this one if that's ok for you. I have some ideas but I'll do that later. I merged the other PR and fixed your issue.

@richardlay
Copy link
Copy Markdown
Author

That's fine it's not very urgent for me. In addition to being able to enable/disabled, I was just thinking maybe you could override the existing options at the controller config level as well. You can reuse the same options structure for consistency.

@fknop fknop merged commit fa53223 into fknop:master Dec 22, 2015
@fknop
Copy link
Copy Markdown
Owner

fknop commented Dec 22, 2015

Hi, it's done. Version 1.6.0 is on npm :) !

@richardlay
Copy link
Copy Markdown
Author

Great work!

@richardlay richardlay deleted the controller-config-support branch December 23, 2015 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants