こんにちは、かたいなかです。 最近では、GitHubのAPIがGraphQLに対応してしばらくたち、また、先日からAWSのAppSyncもパブリックプレビューとして提供されており、世の中のGraphQLへの熱がだんだんと高まってきているのを感じます。 そこで今回から数回に渡って、ScalaのGraphQL実装であるSangriaというライブラリを使用してGraphQLのAPIを実装する方法を紹介していきます。 GraphQL GraphQLはFacebookによって開発されたAPIに対するクエリ言語です。 GraphQLを使用することで、クライアントは必要とするデータの情報をGraphQLのクエリとして送信し、サーバはそれに応じてレスポンスを返します。 これにより、クライアントが一つの画面で必要な情報を得るために何度もAPIに対してリクエストしたり、それを避けるために特定のクライアント専用