Skip to content

Instantly share code, notes, and snippets.

@BjRo
Created February 9, 2017 16:27
Show Gist options
  • Save BjRo/1fe9a7d94cb00d1a64136e1dac4f8e31 to your computer and use it in GitHub Desktop.
Save BjRo/1fe9a7d94cb00d1a64136e1dac4f8e31 to your computer and use it in GitHub Desktop.
val routes =
(post & path("graphql")) {
optionalHeaderValueByName("ACCEPT_LANGUAGE") { accept_language =>
entity(as[JsValue]) { requestJson =>
val context = Context.from(accept_language)
println("ACCEPT_LANGUAGE: " + context.language)
graphQLEndpoint(requestJson, context)
}
}
} ~
{
get {
getFromResource("graphiql.html")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment