Back to directory
sparsetech avatar

trail

Routing library for the Scala platform. Read more below about its uses, features, and usage.

Clone repository

git clone https://github.com/sparsetech/trail.git

82

Stars

8

Forks

3

Watchers

—

License

trail

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

Licence

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

Authors

  • Tim Nieradzik
  • Darren Gibson
  • Anatolii Kmetiuk

Releases

Jan 25, 2021

Download .zip

Release Summary 📝 Version 0.3.1 updates all dependencies, adding support for Scala Native 0.4.0. Change log 🚀

Build: Update dependencies (#42, by @lolgab)

Sep 29, 2020

Download .zip

Release Summary 📝 Version 0.3.0 features several breaking changes. This release also adds support for Scala Native 0.4.0-M2 and Scala.js 1.2.0 while dropping artefacts for Scala Native 0.3.9 and Scal...

Jul 10, 2019

Download .zip

Release Summary 📝 Version 0.2.1 fixes various bugs. It also adds support for Scala 2.13. Migration Steps 💻 The API has not changed. New Features 🚀

Build: Add support for Scala 2.13 (#35)

Bug Fixe...

Release Summary 📝 Version 0.2.0 features a number of user-facing changes. Trail now has zero dependencies, supports Scala Native and has better type inference. You can follow the links below to the p...