All Projects → ulrikstrid → dream-routes

ulrikstrid / dream-routes

Licence: BSD-3-Clause license
Define your Dream router with Routes

Programming Languages

ocaml
1615 projects

Dream Routes

Define your Dream router with Routes.

Example based on Dream's 3-router:

let () =
  Dream.run
  @@ Dream.logger
  @@ Dream_routes.routes Routes.[
    Dream_routes.get @@ empty @--> (fun _request ->
      Dream.html "Good morning, world!");

    Dream_routes.get @@ s "echo" / int /? nil @--> (fun integer _request ->
      Dream.html @@ Printf.sprintf "integer: %i" integer);

    Dream_routes.get @@ s "echo" / str /? nil @--> (fun word _request ->
      Dream.html word);
  ]
  @@ Dream.not_found
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].