We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2ea2339 commit bb8d4dcCopy full SHA for bb8d4dc
server.ts
@@ -0,0 +1,24 @@
1
+import { Server } from "https://deno.land/[email protected]/http/server.ts";
2
+import { GraphQLHTTP } from "./mod.ts";
3
+import { makeExecutableSchema } from "https://deno.land/x/[email protected]/mod.ts";
4
+import { resolvers } from "./resolvers.ts";
5
+import { typeDefs } from "./typedefs.ts";
6
+
7
+const schema = makeExecutableSchema({ resolvers, typeDefs });
8
9
+const server = new Server({
10
+ handler: async (req) => {
11
+ const { pathname } = new URL(req.url);
12
+ console.log(req);
13
14
+ return pathname === "/graphql"
15
+ ? await GraphQLHTTP<Request>({
16
+ schema,
17
+ graphiql: true,
18
+ })(req)
19
+ : new Response("Not Found", { status: 404 });
20
+ },
21
+ port: 3000,
22
+});
23
24
+server.listenAndServe();
0 commit comments