Skip to content

Latest commit

 

History

History
41 lines (33 loc) · 1.45 KB

README.md

File metadata and controls

41 lines (33 loc) · 1.45 KB

Build Status Join the chat at https://gitter.im/sparsetech/trail Maven Central

Trail is a routing library for Scala. It is available for the JVM, Scala.js and Scala Native.

Features

  • Define type-safe routes
  • Parse and generate URLs
  • DSL to extract path elements, arguments and fragments
  • Express routing tables via pattern matching
  • Define custom codecs
  • IDE support
  • Cross-platform support (JVM, Scala.js, Scala Native)
  • Zero dependencies

Example

import trail._

val details  = Root / "details" / Arg[Int]
val userInfo = Root / "user" / Arg[String] & Param[Boolean]("show")

val result = "/user/hello?show=false" match {
  case details (a)      => s"details: $a"
  case userInfo((u, s)) => s"user: $u, show: $s"
}

Links

Licence

Trail is licensed under the terms of the Apache v2.0 licence.

Authors

  • Tim Nieradzik
  • Darren Gibson
  • Anatolii Kmetiuk