/usher

A Scala web app routing library for use with Circlet

Primary LanguageScalaMIT LicenseMIT

Usher

Build Status

Usher is a simple routing library for Scala, and is built on Circlet. Routes are just Handler functions, and are easily composed. Usher is heavily inspired by Compojure.

val app: Handler = routes(
  GET("/") { _ => Response(body = "Usher demo\n") },
  POST("/widget") { req => ... },             // C
  GET("/widget/:id{\\d+}") { req => ... },    // R
  PUT("/widget/:id{\\d+}") { req => ... },    // U
  DELETE("/widget/:id{\\d+}") { req => ... }, // D
  notFound("Computer said no.\n")
)
JettyAdapter.run(app)

See the full example app.

Try it

Latest release:

libraryDependencies ++= Seq(
  "com.markfeeney" % "usher_2.11" % "0.2.1"
)

Project Goals

In priority order:

  1. Composable routes
  2. Maintainable code
  3. Type safe
  4. Fast enough

TODO

License

Copyright © 2016 Mark Feeney

Released under the MIT license.