aboutsummaryrefslogtreecommitdiff
path: root/example.ts
blob: 9364fe06941f56007c0ca0c32c41e3efe23802db (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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 ***/