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

Unable to use GraphiQL explorer on example #1

Open
riszkymf opened this issue Apr 5, 2023 · 0 comments
Open

Unable to use GraphiQL explorer on example #1

riszkymf opened this issue Apr 5, 2023 · 0 comments

Comments

@riszkymf
Copy link

riszkymf commented Apr 5, 2023

Steps to reproduce:

  1. Run server.ts example
  2. Open localhost:3000/graphql on browser.

image

Analysis
Looking at mod.ts line 57 it shows that graphiql options is enabled by default.

        this.server.post(
            "/graphql",
            async (ctx: any, next: any) => {
                const resp = await GraphQLHTTP<Request>({ schema, rootValue, context: (request) => ({ request }), graphiql: true })(ctx.req);
                ctx.res = resp;
                await next();
            },
        );

However the post function prevent user from accessing the GraphiQL explorer on browser.

Possible Solution

  1. Use graphiql: true as an option argument, use get function if it's true.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant