-
Notifications
You must be signed in to change notification settings - Fork 2k
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
return next() on route completion #462
Comments
Merged. Thanks a lot! |
I agree that it's a valid use case but only if you know it will happen. If it was configurable and off by default I think it would be a good change. |
I’m good with it being configurable, that makes sense to me. At least then the behavior is explicit. If we make this change here we should also take a look at the restify package as well |
I agree w/ @Friss - it's a valid use case. I think making it configurable and off by default is a good solution. |
exactly, for now it's impossible to run any post-execution middleware without overriding res.. |
I was working on adding the configurable flag for this but it made the API a tad ugly and more confusing without the background of this. Another option I'd like to suggest, which will be more work but cleaner, is that graphqlExpress returns a promise. Then the user can either choose to use that or ignore it and chain middleware like so:
|
The same case with Koa.
That said, there's a workaround -- change +1 for having that option configurable. Thank you. |
I've recently moved from I need to close my AMQP channels after everything. |
Is there still no way to apply a post completion middleware on a graphql endpoint? |
You can using a Plugin |
Yes, found the answer in this thread. For future readers, beware, the official answer using |
In order to chain pre and post completion middleware the next keyword must be called in all steps along the way. This is mostly valid for Express projects as a way to simulate Restify's 'after' event.
I'll attach a PR to this issue as well, since it's a super simple and unobtrusive change and we can discuss from there!
Thanks
The text was updated successfully, but these errors were encountered: