Apollo-server: Use server's own graphiql package instead of from CDN

Created on 31 Jan 2017  路  22Comments  路  Source: apollographql/apollo-server

_graphql-server_ currently manages its own version of GraphiQL in package-internal code. Maybe I'm missing something but this seems unnecessary given we have npm/yarn.

Is there anything stopping us from serving the version of graphiql installed on the server, instead of doing this? That way we wouldn't need to manage the version separately to what is available on npm.

I realise this would involve serving files from the node server in some way, which is an anti-pattern in production, but I wouldn't expect the proposed (or present) method to be used in production as is anyway.

I'm interested in others' thoughts about this. It seems a shame to always be at least a little bit behind the cutting edge in terms of Developer Experience just because we're using graphql-server.

馃檹 help-wanted

Most helpful comment

@jacobbogers or @luchillo17 please feel free to get started! I think this would be a great improvement.

All 22 comments

Ironically, we're actually ahead of express-graphql: https://github.com/graphql/express-graphql/blob/87fc6d527d0d8fe128130a26bef39e5be2b26da5/src/renderGraphiQL.js#L19

Anyway, I agree it would be a good idea to see if we can get it from npm, but that is a bit more complex because you need a build system, etc. Perhaps we can start by making a list of what we need to do to make this happen?

Oh lol I just realized you sent that PR. But yeah, we essentially copied that logic from express-graphql.

hi @ephemer,
i don't see why this is better then just serve from CDN..?
the thing is that to make it work from a package there is much work to be done,
and i can't the find the reason to invest time into that.. can you explain us please? :D

I think the main reason is to stay up to date with the newest version of GraphiQL, and not have to wait for the CDN url to be updated. Perhaps we can have an option in renderGraphiQL for the version number so that it can be increased manually when necessary?

yes @stubailo i agree with you, we can set default in const and pass another option.
great idea! :)
@ephemer what do you think of the solution?

Oh yeah! That's easy and solves the problem, nice @stubailo

cool @ephemer can you please open another issue for implementing this and close this instead.
also if you want to submit the PR for the actual change, you are welcome =)

This would be a great project for contributor week btw :wink:

@helfer sure, we have a deadline this week so I don't think I'll get to it but I'd be happy to give it a shot when I have a bit more time on my hands

I still think this would be neat to implement.

Hi, anyone working on this already, can I help out or I will start myself

I have an issue with the CDN for react.min.js, however if i change the js string to react.js it works ok:
image

@jacobbogers or @luchillo17 please feel free to get started! I think this would be a great improvement.

Definitely a good idea not only for when the cdn goes down but also for when working in remote locations without internet.

this is related to #506

Does anyone want to sign up to get started on this? Shouldn't take more than a few hours to set up the build and make it run from a local setup.

I'd say a script that just downloads the CDN version and inlines it into the package, or builds with Webpack, would be perfect.

any news ? common

is this a thing yet?

There's a work in progress PR here: https://github.com/apollographql/apollo-server/pull/673 please help!

Apollo Server 2.0 ships with graphql-playground as a direct dependenct, rather than a CDN-hosted version, so I believe this issue can be closed. Happy to reopen if anyone feels different. Thanks for reporting this originally!

https://github.com/apollographql/apollo-server/issues/1421

Apollo Server 2.0 ships with graphql-playground as a direct dependenct, rather than a CDN-hosted version

Using [email protected] and following the getting started guide I get a graphql-playground instance using assets from an external CDN, so I am pretty sure this issue is still open.

As above, there are more details in #1421 and I am working on a fix in #1734

I was incorrect above, this is indeed still an issue, but let's track it in #1421.. Thanks for your work in #1734 鈥斅爓e'll consider how to make that more permanent in Apollo Server, though I think your demonstration in https://github.com/apollographql/apollo-server/pull/1734#issuecomment-424803701 is pretty close to what that will end up being (but less explicitly).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

veeramarni picture veeramarni  路  3Comments

danilobuerger picture danilobuerger  路  3Comments

dobesv picture dobesv  路  3Comments

stevezau picture stevezau  路  3Comments

Magneticmagnum picture Magneticmagnum  路  3Comments