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

Perhaps include request.pre in handler view context #1452

Closed
johnmegahan opened this issue Feb 23, 2014 · 4 comments
Closed

Perhaps include request.pre in handler view context #1452

johnmegahan opened this issue Feb 23, 2014 · 4 comments
Assignees
Labels
feature New functionality or improvement
Milestone

Comments

@johnmegahan
Copy link

If I'm not mistaken, right now the handler view context includes request.payload, request.params, and request.query. It seems it would be useful if this also included request.pre so that you could use pre methods to fetch objects and have them available in the view when using the string shortcut, such as:

route:

server.route({
    method: 'GET',
    path: '/users/{id}',
    config: {
        pre: [
            { method: 'user(params.id)', assign: 'user' }
        ],
        handler: {
            view: 'user-page'
        }
    }
});

template:

<h1>Hello, {{pre.user.name}}</h1>
@hueniverse
Copy link
Contributor

I'll take a PR with test and doc update.

@johnmegahan
Copy link
Author

Sorry if I didn't do that correctly. First actual github pull request. :)

hueniverse pushed a commit that referenced this issue Feb 23, 2014
Include prerequisites in default view context. #1452
@hueniverse
Copy link
Contributor

@johnmegahan perfect!

@hueniverse hueniverse added this to the 2.6.0 milestone Feb 23, 2014
@hueniverse hueniverse self-assigned this Feb 23, 2014
@Marsup Marsup added feature New functionality or improvement and removed request labels Sep 20, 2019
@lock
Copy link

lock bot commented Jan 9, 2020

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.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New functionality or improvement
Projects
None yet
Development

No branches or pull requests

3 participants