我正在使用Http Akka和Scala。 我有這樣的路線:正則表達式的http Akka路由不在編譯
object Route {
val route =
path("items"/"card"/"""\w+""".r) {
get {
complete {
EntitiesData.someEntity
}
}
}
}
出於某種原因,它不與此錯誤編譯:
Error:(18, 11) 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: String => (akka.http.scaladsl.server.RequestContext => scala.concurrent.Future[akka.http.scaladsl.server.RouteResult])
get {
當我刪除了正則表達式的一部分,或者將其更改爲常規字符串的東西似乎工作精細。