Skip to content

enabling pagination only on route config level #19

@lostdalek

Description

@lostdalek

Hi,
not sure if there is a bug or I can't get the configuration right but I would like to disable pagination by default and only enable it on specific route.

this is what i'm trying:
plugin registration (with glue)

registrations: [
        {
            plugin: {
                register: 'hapi-pagination',
                pagination: {
                    enabled: false
                }
            }, ...

and enabling it on specific route (it's working great):

method: 'GET',
path: '/paginatedResource',
config: {
plugins: {
                pagination: {
                    enabled: true,
                    limit: this.paginationLimit
                },
            }
},
handler: ...

but on a route without plugins.pagination configured, I have the following error:

server-0 | Debug: internal, implementation, error
server-0 | Error: Uncaught error: The results must be an array
server-0 | at Object.exports.assert (xxxxx/node_modules/hoek/lib/index.js:736:11)

manually setting pagination.enabled = false in the route config is working, but I don't want to explicitly disable on route level
and I don't want to maintain a global exclude or include route array in the plugin configuration.
I only want to enable when I need on route configuration level

I'm I doing something wrong?
thanks!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions