summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/server.rb25
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/server.rb b/lib/server.rb
index 6b14bf7..600dce5 100644
--- a/lib/server.rb
+++ b/lib/server.rb
@@ -1,7 +1,30 @@
require 'rack'
+require 'json'
+require 'graphql'
+
+module Types
+ class QueryType < GraphQL::Schema::Object
+ field :me, String, null: false
+
+ def me
+ 'mo'
+ end
+ end
+end
+
+class MySchema < GraphQL::Schema
+ max_complexity 400
+ query Types::QueryType
+end
class Server
def call(env)
- [200, {}, []]
+ query = '{ me }'
+
+ [
+ 200,
+ { 'Content-Type' => 'application/graphql' },
+ [MySchema.execute(query).to_json]
+ ]
end
end