package trail

  1. Overview
  2. Docs
A minimalistic, composable web framework for building HTTP/WebSocket servers

Install

Dune Dependency

Authors

Maintainers

Sources

trail-0.0.1.tbz
sha256=0a034596e0a8527cf775efc1c4bb08bdccb39971164a11bddcf6ee358e593c5e
sha512=012591f9c9b88ab774a577d6b534019f8270888999834d71aeddf33f92fbd09c4f56449aeafc3ccc7850558a555177f626e46b66355251249824ffcbd4f2294b

Description

Trail is a minimalistic, composable framework for building HTTP/WebSocket servers for Riot, inspired by Elixir's Plug & WebSock. It provides you with a small set of abstractions for building trails that can be assembled to handle a request. This includes a logger, a router, a socket endpoint, an interface to handling web socket frames, and more

README

Trail

Trail is a minimalistic, composable framework for building HTTP/WebSocket servers, inspired by Plug & [WebSock][websock]. It provides its users with a small set of abstractions for building trails that can be assembled to handle a request.

To create a Trail, you can use the syntax Trail.[fn1;fn2;fn3;...], where each function takes a connection object and an arbitrary context, to produce a new connection object.

For example:

open Trail
open Router

let endpoint =
  [
    use (module Logger) Logger.(args ~level:Debug ());
    router
      [
        socket "/ws" (module My_handler) ();
        get "/" (fun conn -> Conn.send_response `OK {%b|"hello world"|} conn);
        scope "/api"
          [
            get "/version" (fun conn ->
                Conn.send_response `OK {%b|"none"|} conn);
          ];
      ];
  ]

Dependencies (9)

  1. dune >= "3.11"
  2. uuidm >= "0.9.8"
  3. riot >= "0.0.9"
  4. ppx_bitstring >= "4.1.0"
  5. ocaml >= "5.1.0"
  6. magic-mime >= "1.3.1"
  7. http >= "6.0.0~beta2"
  8. bytestring >= "0.0.1"
  9. atacama >= "0.0.5"

Dev Dependencies (4)

  1. odoc with-doc
  2. qcheck with-test & >= "0.21.3"
  3. mdx with-test & >= "2.3.1"
  4. alcotest with-test & >= "1.7.0"

Used by (1)

  1. nomad

Conflicts

None

OCaml

Innovation. Community. Security.