title: Akka-Http load css&js resources
body: <p>I want to use akka-http like http server (for example tomcat or nginx server) .<br>
  with this simple code can load html sources from web browsers but can not load other source linked on html file .    </p>
  
  <pre><code>import akka.actor.ActorSystem
  import akka.http.scaladsl.Http
  import akka.http.scaladsl.server.Directives._
  import akka.stream.ActorMaterializer
  
  import scala.io.StdIn
  
  object MainRunner extends App {
  
    implicit val system = ActorSystem("mySystem")
    implicit val materializer = ActorMaterializer()
    implicit val ec = system.dispatcher
  
    val staticResources =
      get {
          path("admin") {
            getFromResource("admin/index.html")
          } ~ pathPrefix("admin") {
          getFromResourceDirectory("admin")
        }
      }
  
    val bindingFuture = Http().bindAndHandle(staticResources, "localhost", 8080)
  
    println(s"Server online at http://localhost:8080/\nPress RETURN to stop...")
    StdIn.readLine() // let it run until user presses return
    bindingFuture
      .flatMap(_.unbind()) // trigger unbinding from the port
      .onComplete(_ =&gt; system.terminate()) // and shutdown when done
  }
  </code></pre>
  
  <p>this is my html file :   </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;Title&lt;/title&gt;
      &lt;link rel="stylesheet" href="main.css"&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h1&gt;Admin area&lt;/h1&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and receive this error in browser : 
  <a href="https://i.stack.imgur.com/EKvow.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EKvow.png" alt="enter image description here"></a>
  This is directory structure :<br>
  <a href="https://i.stack.imgur.com/Hf7ug.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Hf7ug.png" alt="enter image description here"></a></p>
  
  <p>How can fix this problem ? </p>