In a demo project, https://github.com/chbatey/akka-http-typed the following code exists, which compiles but I can't understand how is it that the expression "Http()(untypedSystem).bindAndHandle(routes.userRoutes, "localhost", 8080)" can compile given that the bindAndHandle method takes the parameters below (so first one should be a Flow, but it is a Route, i.e. a RequestContext ⇒ Future[RouteResult] function type).
In another project, I get the compilation error, which I can understand, because the actual parameter has type Route, but the declared type of the first argument if Flow.
Please advice.
//def bindAndHandle(
// handler: Flow[HttpRequest, HttpResponse, Any],
// interface: String, port: Int = DefaultPortForProtocol,
// connectionContext: ConnectionContext = defaultServerHttpContext,
val serverBinding: Future[Http.ServerBinding] = Http()(untypedSystem).bindAndHandle(routes.userRoutes, "localhost", 8080)
//type of routes.userRoutes is Route
//where type Route = RequestContext ⇒ Future[RouteResult]
//how can it be that this compiles? In another project it does not (which makes more sense to me)