aboutsummaryrefslogtreecommitdiff
path: root/source/http.ts
diff options
context:
space:
mode:
authornetop://ウィビ <paul@webb.page>2026-10-21 16:47:38 -0700
committernetop://ウィビ <paul@webb.page>2026-10-21 16:47:38 -0700
commit389ad1349c4ff245a3466a2e361c1cd1dd11d2ba (patch)
tree0ad0638f60ab0a77c7a095e96b472312ab39f83b /source/http.ts
parentbbcbb02ef64d094f0f13de22ae135eeba1ff4c5d (diff)
downloadgq-389ad1349c4ff245a3466a2e361c1cd1dd11d2ba.tar.gz
gq-389ad1349c4ff245a3466a2e361c1cd1dd11d2ba.zip
MAJOR RELEASEHEADprimary
- inlined vendored dependencies from npm - makes this module work in Ende
Diffstat (limited to '')
-rwxr-xr-xsource/http.ts10
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, {