Reviewing MyService

Let's use the sample com.sample.MyService as a learning tool and review the code piece by piece.

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>
          }
        }
      }
    }
}

spray.routing.HttpService

The service trait extends spray.routing.HttpService and offers a single val myRoute of type Route.

The type provides PathMatchers, Directives, Routes, and a few implicits.

FIXME List the matchers, directives and routes used in the code above.

results matching ""

    No results matching ""