Reviewing com.example.MyService

As pointed out in Introduction, com.example.MyService is an excellent source of information about how to structure your future Spray applications.

It contains the following code:

trait MyService extends HttpService {

  val myRoute =
    path("") {
      get {
        respondWithMediaType(`text/html`) { // XML is marshalled to `text/xml` by default, so we simply override here
          complete {
            <html>
              <body>
                <h1>Say hello to <i>spray-routing</i> on <i>spray-can</i>!</h1>
              </body>
            </html>
          }
        }
      }
    }
}

results matching ""

    No results matching ""