title: akka-http with multiple route configurations
body: <h2>Quick Background</h2>
  
  <p>I am running through some examples learning the Akka HTTP stack for creating a new REST project (completely non-UI).  I have been using and augmenting the <a href="http://www.typesafe.com/activator/template/akka-http-microservice">Akka HTTP Microservice Example</a> to work through a bunch of use cases and configurations and have been pleasantly surprised by how well Scala &amp; Akka HTTP work.</p>
  
  <h2>Current Setup</h2>
  
  <p>Currently I have a configuration like this:</p>
  
  <pre><code>object AkkaHttpMicroservice extends App with Service {
    override implicit val system = ActorSystem()
    override implicit val executor = system.dispatcher
    override implicit val materializer = ActorMaterializer()
  
    override val config = ConfigFactory.load()
    override val logger = Logging(system, getClass)
  
    Http().bindAndHandle(routes, config.getString("http.interface"), config.getInt("http.port"))
  }
  </code></pre>
  
  <p>The <code>routes</code> parameter is just a simple value that has the typical data within it using <code>path</code>, <code>pathPrefix</code>, etc.</p>
  
  <h2>The Problem</h2>
  
  <p>Is there any way to set up routing in multiple Scala files or an example somewhere out there?</p>
  
  <p>I would really like to be able to define a set of classes that separate the concerns and deal with Actor setup and processing to deal with different areas of the application and just leave the marshaling to the root <code>App</code> extension.</p>
  
  <p>This might be me thinking too much in terms of how I did things in Java using annotations like <code>@javax.ws.rs.Path("/whatever")</code> on my classes.  If that is the case, please feel free to point out the change in mindset.</p>
  
  <p>I tried searching for a few different set of keywords but believe I am asking the wrong question (eg, <a href="https://www.google.com/search?q=akka-http+route+definitions+in+multiple+locations&amp;ie=utf-8&amp;oe=utf-8">1</a>, <a href="https://www.google.com/search?q=akka-http+route+definitions+in+multiple+locations&amp;ie=utf-8&amp;oe=utf-8#q=akka-http+using+implicits+to+define+route+handling">2</a>).</p>