diff options
| author | netop://ウィビ <paul@webb.page> | 2026-10-21 16:47:38 -0700 |
|---|---|---|
| committer | netop://ウィビ <paul@webb.page> | 2026-10-21 16:47:38 -0700 |
| commit | 389ad1349c4ff245a3466a2e361c1cd1dd11d2ba (patch) | |
| tree | 0ad0638f60ab0a77c7a095e96b472312ab39f83b /source/http.ts | |
| parent | bbcbb02ef64d094f0f13de22ae135eeba1ff4c5d (diff) | |
| download | gq-389ad1349c4ff245a3466a2e361c1cd1dd11d2ba.tar.gz gq-389ad1349c4ff245a3466a2e361c1cd1dd11d2ba.zip | |
- inlined vendored dependencies from npm
- makes this module work in Ende
Diffstat (limited to 'source/http.ts')
| -rwxr-xr-x | source/http.ts | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source/http.ts b/source/http.ts index c4a70c8..39d6866 100755 --- a/source/http.ts +++ b/source/http.ts @@ -54,6 +54,14 @@ export function GraphQLHTTP< ...options }: GQLOptions<Ctx, Req>): GraphQLHandler<Req> { return async (request: Req) => { + if (options.graphiql) { + const { serveAsset } = await import("./graphiql/assets.ts"); + const asset = serveAsset(request); + + if (asset) + return asset; + } + if (options.subscriptions && request.headers.get("upgrade")?.toLowerCase() === "websocket") return options.subscriptions(request as unknown as Request); @@ -91,7 +99,7 @@ export function GraphQLHTTP< const playground = renderPlaygroundPage({ ...playgroundOptions, - endpoint: "/graphql" + endpoint: new URL(request.url).pathname }); return new Response(playground, { |