Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
24 lines (21 sloc) 551 Bytes
defmodule GraphQL.Schema.HelloWorld do
alias GraphQL.Schema
alias GraphQL.Type.ObjectType
alias GraphQL.Type.String
def schema do
%Schema{
query: %ObjectType{
name: "HelloWorld",
fields: %{
greeting: %{
type: %String{},
args: %{name: %{type: %String{}}},
resolve: {Schema.HelloWorld, :greeting}
}
}
}
}
end
def greeting(_source, %{name: name}, _info), do: "Hello, #{name}!"
def greeting(_source, _args, _info), do: "Hello, world!"
end