Skip to content

purescript-hyper/purescript-trout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trout
Trout

Type-Level Routing for PureScript


Trout is a Servant-style routing type API. By using routing types you get static guarantees about having handled all cases. You also get a lot of stuff for free, such as type-safe parameters for handlers, and automatically generated type-safe URIs to endpoints.

The primary use of Trout right now is for Hyper and the purescript-hypertrout server package. There is, however, nothing Hyper-specific about this package.

Usage

bower install --save purescript-trout

This package should get its own proper documentation soon. In the meantime, see purescript-hypertrout.

API Documentation

This library's API documentation is published on Pursuit.

Changelog

  • 0.12.3
    • Update for argonaut API changes.
  • 0.12.2
    • Add Header.
  • 0.12.1
    • Add ReqBody.
  • 0.12.0
    • PureScript 0.13 compiler support
    • Various dependency upgrades
  • 0.11.0
    • PureScript 0.12 compiler support
    • Various dependency upgrades
  • 0.10.0
    • Routes are now named. The following routes are written in the old format, compatible with 0.9.x:

      type TestSite =
             Resource (Get (HTML :<|> JSON) Home)
        :<|> "users" :/ Resource (Get (HTML :<|> JSON) Home)

      When ported to 0.10.0, they become named:

      type TestSite =
             "home"  := Resource (Get (HTML :<|> JSON) Home)
        :<|> "users" := "users" :/ Resource (Get (HTML :<|> JSON) Home)

      The route name and the literal route segments are orthogonal; there is no relation between the name "users" and the segment "users" in the above routes, as far as Trout is concerned. The name is only used to identify the route when deriving functionality from the routes, e.g. to obtain a URI to a specific resource.

  • 0.9.1
    • Change AltE infix operator to right-associative
  • 0.9.0
    • Add support for query params
    • Move content types to Method, instead of in Resource, e.g. Resource (Get MyThing) JSON becomes Resource (Get MyThing JSON).
  • 0.8.1
    • Better documentation on the Trout API
  • 0.8.0
    • Rename top-module to Type.Trout
  • 0.7.0
    • Rename to Trout
    • Bump deps for 0.11.x compatibility
  • 0.6.0
    • Restructure API to include notion of a Resource
  • 0.5.0
    • Remove server part, keep only API
  • 0.4.1
    • Use Hyper 0.4.1
  • 0.4.0
    • Use upcoming Hyper 0.4.0
    • Initial version, extracted from main Hyper repo

License

Mozilla Public License Version 2.0

Logo credit: https://commons.wikimedia.org/wiki/File:Lake_Trout_GLERL.jpg