Trong khi chơi với, akka-http thử nghiệm 1.0-M2 Tôi đang cố gắng tạo một ví dụ đơn giản Hello world.không thể tìm thấy tiềm ẩn ...: akka.http.server.RoutingSetup
import akka.actor.ActorSystem
import akka.http.Http
import akka.http.model.HttpResponse
import akka.http.server.Route
import akka.stream.FlowMaterializer
import akka.http.server.Directives._
object Server extends App {
val host = "127.0.0.1"
val port = "8080"
implicit val system = ActorSystem("my-testing-system")
implicit val fm = FlowMaterializer()
val serverBinding = Http(system).bind(interface = host, port = port)
serverBinding.connections.foreach { connection ⇒
println("Accepted new connection from: " + connection.remoteAddress)
connection handleWith Route.handlerFlow {
path("") {
get {
complete(HttpResponse(entity = "Hello world?"))
}
}
}
}
}
Compilation không thành công với could not find implicit value for parameter setup: akka.http.server.RoutingSetup
Ngoài ra, nếu tôi thay đổi
complete(HttpResponse(entity = "Hello world?"))
với
complete("Hello world?")
tôi nhận được một lỗi: type mismatch; found : String("Hello world?") required: akka.http.marshalling.ToResponseMarshallable