Hello.
We attempting to integrate Play with AkkaHttpServer into our MQTT Akka implementation [1] as indicated here:
https://www.playframework.com/documentation/2.6.x/ScalaEmbeddingPlayAkkaHttp
In particular, we have used different combinations proposed by this page and all of them work, but we have detected we are not able to make play to also serve routing defined by our conf/routes.
We have found that we can extend the following code (provided at ScalaEmbeddingPlayAkkaHttp) to also serve static assets:
val _server = AkkaHttpServer.fromRouterWithComponents (serverConfig) { components =>
import Results._
import components.{ defaultActionBuilder => Action }
{
case GET(p"/hello/$to") => Action {
Ok(views.html.index(to))
/* Ok(s"Hello $to") */
}
}
}
…by using examples from https://github.com/lightbend/lightbend-markdown/blob/master/server/src/main/scala/com/lightbend/markdown/server/DocumentationServer.scala
(for example, using code like this):
case GET(p"/$name/resources/$path*") if nameExists(name) => Action {
sendFileInline(name, path).getOrElse(NotFound("Resource not found [" + path + "]"))
}
However, support provided by conf/routes ( https://www.playframework.com/documentation/2.6.x/ScalaRouting ) is much more than that. It provides a lot of features (along with loading static assets).
In this context, we would like to be able embed Play Server with support for conf/routes defined.
Please, could you give us some advise how to do this?
Thanks for your time and patience.