aboutsummaryrefslogtreecommitdiff
path: root/example.ts
diff options
context:
space:
mode:
Diffstat (limited to 'example.ts')
-rw-r--r--example.ts29
1 files changed, 29 insertions, 0 deletions
diff --git a/example.ts b/example.ts
new file mode 100644
index 0000000..9364fe0
--- /dev/null
+++ b/example.ts
@@ -0,0 +1,29 @@
+
+
+
+/*** UTILITY ------------------------------------------ ***/
+
+import { executeSchema, GraphQLHTTP, gql } from "./entry.ts";
+
+const schema = executeSchema({
+ resolvers: {
+ Query: {
+ hello: (_: unknown, { name }: { name?: string }) => `hello, ${name ?? "world"}`
+ }
+ },
+ typeDefs: gql`type Query { hello(name: String): String }`
+});
+
+const handler = GraphQLHTTP({
+ graphiql: true,
+ playgroundOptions: { version: "0.4.0" },
+ schema
+});
+
+/*** PROGRAM ------------------------------------------ ***/
+
+Deno.serve({ port: 4000 }, handler);
+
+
+
+/*** deno run -A example.ts ***/