Skip to content

Unable to use GraphiQL explorer on example #1

@riszkymf

Description

@riszkymf

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions