Add the following code to your project's shard.yml under:
dependencies
to use in production
- OR -
development_dependencies
to use in development
Add the dependency to your shard.yml
:
dependencies:
amaretto:
github: amaretto-graphql/amaretto
Run shards install
require "amaretto"
module Untitled
class Schema < Amaretto::Schema
@[Amaretto::Annotations::Query]
def list_users : Array(String)
[] of String
end
@[Amaretto::Annotations::Mutation]
def create_user(string : String) : String
raise Exception.new("User #{string} already exists!")
end
end
end
query = Untitled::Schema::Query.new
mutation = Untitled::Schema::Mutation.new
schema = GraphQL::Schema.new(query, mutation)
puts schema.document.to_s
See the examples directory for detailed usage with Kemal or Grip
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)