Skip to content
This repository was archived by the owner on Dec 20, 2024. It is now read-only.

Use GraphQL Tools Url Loader #33

Merged
merged 15 commits into from
May 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules
!.gitignore
!.github
!.prettierignore

542 changes: 0 additions & 542 deletions examples/context/yarn.lock

This file was deleted.

2 changes: 1 addition & 1 deletion examples/csp/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "graphql-helix-example-express",
"name": "graphql-helix-example-csp",
"version": "1.0.0",
"private": true,
"scripts": {
Expand Down
506 changes: 0 additions & 506 deletions examples/csp/yarn.lock

This file was deleted.

494 changes: 0 additions & 494 deletions examples/error-handling/yarn.lock

This file was deleted.

494 changes: 0 additions & 494 deletions examples/express/yarn.lock

This file was deleted.

375 changes: 0 additions & 375 deletions examples/fastify/yarn.lock

This file was deleted.

635 changes: 0 additions & 635 deletions examples/file-upload/yarn.lock

This file was deleted.

599 changes: 0 additions & 599 deletions examples/graphql-jit/yarn.lock

This file was deleted.

606 changes: 0 additions & 606 deletions examples/graphql-modules/yarn.lock

This file was deleted.

16 changes: 14 additions & 2 deletions examples/graphql-ws/server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import express from "express";
import { getGraphQLParameters, processRequest } from "graphql-helix";
import {
getGraphQLParameters,
processRequest,
renderGraphiQL,
shouldRenderGraphiQL,
} from "graphql-helix";
import { execute, subscribe, GraphQLError } from "graphql";
import { createServer } from "graphql-ws";
import { schema } from "./schema";
Expand All @@ -15,7 +20,14 @@ app.use("/graphql", async (req, res) => {
method: req.method,
query: req.query,
};

if (shouldRenderGraphiQL(request)) {
res.send(
renderGraphiQL({
subscriptionsEndpoint: "ws://localhost:4000/graphql",
})
);
return;
}
const { operationName, query, variables } = getGraphQLParameters(request);

const result = await processRequest({
Expand Down
Loading