Revert "Expose composed middleware via getMiddleware()" #3046
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This reverts commit 4149a97 from #2435,
which has resulted in a change to middleware endpoints which I need to think about a bit more and just caught just before the graduation of the 2.7.0 release to
latest
.In a nutshell 🌰: While this affects the
apollo-server-express
andapollo-server-koa
integrations directly, the previous pattern allowed thepath
to function in a wildcard-y/glob-y manner which also allowed, e.g.,/graphql-literally-anything
to work as the GraphQL endpoint (for both GraphQL Playground and actual GraphQL execution). In reality, I don't think that should have been permitted, but if anyone had inadvertently leveraged this pattern, they might be surprised by this change. In particular, theapollo-server
package, which leveragesapollo-server-express
under the hood, specifiespath: '/'
, so it falls into this category of permissiveness.The change being reverted here implemented a more exacting path match, which is arguably more correct, but I need to convince myself that this is fine for a bit longer so I'm going to punt this to 2.8.0 without enough time to discuss further.
That saddens me greatly as I'm quite excited about the newfound freedom that
getMiddleware
would have provided to those that previously felt constrained by theapplyMiddleware
pattern, but I think I can get clarity on this relatively soon and re-ship it. It does seem to work quite well!