Skip to content

Instantly share code, notes, and snippets.

@oxbowlakes
Last active May 10, 2018 11:52
Show Gist options
  • Save oxbowlakes/f4850496b98b8eeb3374927fdffe7305 to your computer and use it in GitHub Desktop.
Save oxbowlakes/f4850496b98b8eeb3374927fdffe7305 to your computer and use it in GitHub Desktop.
Error:(117, 26) type mismatch;
found : akka.http.scaladsl.server.Route
(which expands to) akka.http.scaladsl.server.RequestContext => scala.concurrent.Future[akka.http.scaladsl.server.RouteResult]
required: akka.stream.scaladsl.Flow[akka.http.scaladsl.model.HttpRequest,akka.http.scaladsl.model.HttpResponse,Any]
Http().bindAndHandle(route, thisHost, port) onComplete {
//where:
val route: Route = ???
//and yet the documentation: http://doc.akka.io/docs/akka-http/current/scala/http/routing-dsl/index.html
val bindingFuture = Http().bindAndHandle(route, "localhost", 8080)
//So - does bindAndHandle accept a Route, a Flow, or what? How do I turn a Route into a Flow?
@XOfSpades
Copy link

Exactly my problem. Did you find a solution on that?

@uweplonus
Copy link

If anybody else has this problem, the solution to this is simple (even not explicitly explained):

Add an implicit val like

implicit val materializer = ActorMaterializer()

which is in the dependency

"com.typesafe.akka" %% "akka-stream" % "2.5.11" // or any current version

After including the implicit val the system compiles for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment