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

[v2] Any plans to export graphqlExpress as well from apollo-server-express #1726

Closed
subeeshcbabu-zz opened this issue Sep 25, 2018 · 6 comments

Comments

@subeeshcbabu-zz
Copy link

applyMiddleware really helps to add the middleware existing app.

const server = new ApolloServer({
  // These will be defined for both new or existing servers
  typeDefs,
  resolvers,
});

server.applyMiddleware({ app }); // app is from an existing express app

However it would be really awesome, if the graphqlExpress is also exposed to users.

Any possible way to access graphqlExpress directly from ApolloServer or the apollo-server-express module?

This will really help anyone want to pass the middleware function to lets say a router module that would take of applying the middleware.

@sbrichardson
Copy link
Contributor

Kind of a hack, but you can import it currently from here:

import { graphqlExpress } from 'apollo-server-express/dist/expressApollo'

I'm using it to extend ApolloServer with a custom async schema (example)

@subeeshcbabu-zz
Copy link
Author

Thanks @sbrichardson. That is exactly what i am also doing right now. Thought i could avoid the /dist reference. :-)

Thanks for sharing the example code.

@mjasnikovs
Copy link

Any clue where to acquire "graphiqlExpress" ?

@razor-x
Copy link

razor-x commented Oct 19, 2018

@mjasnikovs See my related comment here: #1308 (comment)

@razor-x
Copy link

razor-x commented Oct 19, 2018

I've noticed there are a lot of similar requests coming in for the missing middleware in v2. I'm wondering if we should consolidate them in one issue and close the others.

This one seems like the best candidate: #1308

@abernix
Copy link
Member

abernix commented Oct 22, 2018

Thank you for your help triaging, @razor-x! Agree on consolidating, and definitely something we're aware of. The workaround above can be utilized in a pinch, but we do intend to address this.

Let's take any further discussion to #1308. Thanks!

@abernix abernix closed this as completed Oct 22, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants