this might be a stupid question, but I need to ask since I havent found an answer to it yet. I have used the akka-http with routing with the typical routing pattern of a path with a
complete with a HttpRequest.
For instance:
~ path("reactJS") {
complete(
HttpResponse(entity = HttpEntity(ContentTypes.`text/html(UTF-8)`, Source.fromFile(reactJS).mkString))
)
}
However, I would like to have a separate actor that handles a file system and then, in my mind, I would like the server to pass the request over to the file handler actor. So my question would be, how would one naturally do a complete of a request with a dependency on another actor? I guess then the server would have a routing looking like:
~ path("patient" / IntNumber) { index =>
FileHandler ! index
}
class FileHandler extends Actor{
def receive = {
case msg:Int => sender() ! file handling
}
and the serving of the request would have to be a case in the receive method of the server, right?
looking into:How to respond with the result of an actor call?