Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove custom before handler in favour of ootb lifecycle hooks on routes #12

Closed
kristofsajdak opened this issue Dec 3, 2015 · 0 comments · Fixed by #21
Closed

Remove custom before handler in favour of ootb lifecycle hooks on routes #12

kristofsajdak opened this issue Dec 3, 2015 · 0 comments · Fixed by #21

Comments

@kristofsajdak
Copy link
Contributor

As of hapi 10.40 hapi supports adding lifecycle extensions at the route level in the route config: hapijs/hapi#2566

We can now do the following

config: {
            ext: {
                onPreHandler: {
                    method: function (req, reply) {
                        var data = req.payload.data
                        data.timeOfReception = new Date()
                        reply.continue()
                    }
                }
            }
        }

Proposing we remove the specific before handler code in hapi-harvester : https://github.com/agco/hapi-harvester/blob/develop/lib/plugin.js#L157

and leverage the standard lifecycle route handlers instead

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 a pull request may close this issue.

1 participant