Skip to content

Instantly share code, notes, and snippets.

@duanebester
Created November 20, 2019 19:10
Show Gist options
  • Save duanebester/b6a6dbd977e46a2b44eecd889c3dd55e to your computer and use it in GitHub Desktop.
Save duanebester/b6a6dbd977e46a2b44eecd889c3dd55e to your computer and use it in GitHub Desktop.
Endpoint with vars
QueryParser.parse(query) match {
case Success(queryAst) =>
val variables = fields.get("variables") match {
case Some(obj: JsObject) => obj
case _ => JsObject.empty
}
complete(executeGraphQLQuery(queryAst, None, variables))
case Failure(error) =>
complete(BadRequest, JsObject("error" -> JsString(error.getMessage)))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment