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

GraphiQL endpoint requires an internet connection #85

Open
dkbarn opened this issue Jun 2, 2020 · 3 comments
Open

GraphiQL endpoint requires an internet connection #85

dkbarn opened this issue Jun 2, 2020 · 3 comments
Assignees

Comments

@dkbarn
Copy link

dkbarn commented Jun 2, 2020

I am trying to go through the tartiflette tutorial at https://tartiflette.io/docs/tutorial/getting-started
This is being done on a machine behind a firewall, which does not have outside internet access.
The built-in graphiql endpoint at http://localhost:8080/graphiql just displays "Loading..." forever. This is because it tries and fails to download a bunch of resources from http://cdn.jsdelivr.net

What are my options for getting GraphiQL up and running locally, without an internet connection?

@dkbarn
Copy link
Author

dkbarn commented Jun 5, 2020

Suggestion: Could there be an additional option added to the graphiql_options dictionary which allows you to override the resource directory for all of the .js and .css files currently being pulled from CDN?

So for example, the resource base would default to "//cdn.jsdelivr.net" but this could be overridden to a local path if I have a mirrored copy of the resource files on disk.

@dkbarn
Copy link
Author

dkbarn commented Jun 16, 2020

To anyone else facing this issue: In the end I just hosted static copies of the js/css resource files via aiohttp directly, rather than enabling the built-in graphiql endpoint provided by tartiflette-aiohttp.

Example code:

from aiohttp import web
from tartiflette_aiohttp import register_graphql_handlers

app = register_graphql_handlers(...)

# Register /graphiql endpoint
graphiql_dir = "/path/to/static/graphiql/resources"
app.router.add_static("/graphiql", graphiql_dir)

async def graphiql_handler(request):
    """Redirector to handle /graphiql -> /graphiql/index.html"""
    return web.HTTPFound("/graphiql/index.html")
app.router.add_route("GET", "/graphiql", graphiql_handler)

@abusi
Copy link
Contributor

abusi commented Jun 17, 2020

@jugdizh Thanks, i'll update the documentation accordingly.

@abusi abusi self-assigned this Jun 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants