Skip to content
Bryce Anderson edited this page Dec 15, 2015 · 12 revisions

Rho: A DSL for building HTTP services with http4s

/// src_inlined SimplePath core/src/test/scala/ApiExamples.scala
new RhoService {
  GET / "hello" |>> { () => Ok("Hello, world!") }
}
/// end_src_inlined

What distinguishes rho from the http4s-core dsl?

  • The http4s-core dsl defines routes in terms of partial functions using pattern matching extractors while rho uses a set of 'rules' to match and extract information from the request.
  • Rho maintains meta data such as the names of extracted parameters and their types which can be reused for tasks such as generation of Swagger documentation.
  • Rho routing is implemented as an efficient tree structure as opposed to a linear search.

How does rho compare other Scala http frameworks?

  • Rho is similar in intention to the red-eyes project: maintaining metadata.
  • Rho route definition feels similar to Finch and Scalatra.

Help build the rho wiki!

The rho wiki is setup to automatically inline code snippets from the repository! See all those code blocks of the form:

/// src_inlined SimplePath core/src/test/scala/ApiExamples.scala
/// end_src_inlined

Those are automatically inlined from the github source repo based on the tags

/// src_inlined TAGNAME CODE.PATH and

/// end_src_inlined.

That means that the examples are just fragments of test code found in the master branch. You can contribute by contributing example fragments to the repository and then inlining them in the wiki by including the two tags on their own lines (typically inside a code block). Once the page is saved, give it a few seconds and refresh to see the fragment inlined in the wiki!

Note: if errors are found (missing tags, missing source file, etc) the page will not be updated.

Clone this wiki locally