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

Swap prepost for grappling-hook #1346

Merged
merged 2 commits into from
Apr 27, 2015
Merged

Conversation

creynders
Copy link
Contributor

With grappling-hook having its pre/post middleware registration rewritten, its fully keystone 0.3.x compatible. This is a replacement for #1239 and uses the new grappling-hook version.

Let's finally :shipit:

I'll make a separate PR for adding a few oft requested hooks.

@dcousens
Copy link
Member

Untested ACK from me. Will test tomorrow.
LGTM though.

@creynders
Copy link
Contributor Author

@dcousens The (idea of the) last commit was cleared with @JedWatson BTW on slack. A bit too fragmented to paste here.

@creynders
Copy link
Contributor Author

We’ve got a bit of an ambiguous situation BTW: Currently in keystone pre:routes middleware is considered to be express middleware, however it is registered with our pre/post methods, so the question is: do we want to keep them as express middleware or are we going to regard them as grappling-hook middleware that happens to be used as express middleware?

creynders [14:17]
Code-wise, both are trivial to setup with grappling-hook.

creynders [14:18]
In concreto: ATM all pre:routes middleware is fed directly to app.use, i.e. they are all separate express middleware functions

creynders [14:19]
while in the other case I’d set up a single express middleware function which calls callHook(‘pre:routes’)

Benefit of going for grappling-hook middleware: it’ll allow all grappling-hook kind of middleware:
function(req, res) //sync function(req, res, next) //async function(req, res, next, done) //async paralell (edited)

creynders [14:22]
And is obviously more consistent with the other hooks we are/will be providing

creynders [14:23]
And it’s still express middleware compatible, i.e. people won’t know the difference

jed [14:23]
I like it

@JedWatson
Copy link
Member

@creynders don't we want grappling-hook ^2.1.0 here?

Super uneasy about the lack of tests over those file field types. Let's fix that soon 😣

@creynders
Copy link
Contributor Author

Ah, yes, nice catch @JedWatson

force pushing it in a sec

@dcousens
Copy link
Member

Can we get this in a keystone branch so that we can work in this PR
together?
On 27 Apr 2015 10:39 pm, "creynders" [email protected] wrote:

Ah, yes, nice catch @JedWatson https://github.com/jedwatson

force pushing it in a sec


Reply to this email directly or view it on GitHub
keystonejs/keystone#1346 (comment).

@creynders
Copy link
Contributor Author

Sure... but why exactly @dcousens ? Wouldn't it better to land this and then have separate feature branches for adding more hooks?

@dcousens
Copy link
Member

I was going to help put this under test.
On 27 Apr 2015 22:59, "creynders" [email protected] wrote:

Sure... but why exactly @dcousens https://github.com/dcousens ?
Wouldn't it better to land this and then have separate feature branches for
adding more hooks?


Reply to this email directly or view it on GitHub
keystonejs/keystone#1346 (comment).

@dcousens
Copy link
Member

I'm happy to submit the PR to you, just figured I'd ask.
On 27 Apr 2015 23:01, "Daniel Cousens" [email protected] wrote:

I was going to help put this under test.
On 27 Apr 2015 22:59, "creynders" [email protected] wrote:

Sure... but why exactly @dcousens https://github.com/dcousens ?
Wouldn't it better to land this and then have separate feature branches for
adding more hooks?


Reply to this email directly or view it on GitHub
keystonejs/keystone#1346 (comment).

@creynders
Copy link
Contributor Author

@dcousens Ah no sorry, thought you had a different reason altogether. I'll close this one, and create a new PR from a keystonejs branch

@JedWatson
Copy link
Member

I think it's fine to merge this and add tests in a separate PR. From my review, it looks good so I'm happy to have it in master. We've also got a stable build out there as of the weekend so it's a safe time to do that. We'll work through any issues that come up.

JedWatson added a commit that referenced this pull request Apr 27, 2015
Swap `prepost` for `grappling-hook`
@JedWatson JedWatson merged commit 101d7ca into keystonejs:master Apr 27, 2015
@JedWatson JedWatson removed the ready label Apr 27, 2015
@creynders
Copy link
Contributor Author

🌈 🐧 🌷

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.

4 participants