package yurt

  1. Overview
  2. Docs
An HTTP framework for OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

yurt-0.6.tbz
sha256=35b5c3e2e89d2a786d117109fc93e2fa501ed87e925d846d45573e95ab266815
md5=881c8406d690a5ebb896a57ae93d04ec

Description

Yurt provides a simple API for creating HTTP servers based on Cohttp and Lwt. See https://github.com/zshipko/yurt for more information.

Published: 31 Aug 2018

README

Yurt

yurt is an HTTP microframework for OCaml based on Cohttp.

Features

  • Simple API

  • Multipart forms

  • Regex based URL routing

  • Functional templates

Installation

opam install yurt

Usage

open Yurt

let _ =
let open Server in

(* Create a server *)
server "127.0.0.1" 1234

(* Add a handler *)
>| get "/<name:string>" (fun req params body ->
    (* Get the url parameter called `name` *)
    let name = Route.string params "name" in
    let body = Yurt_html.h1 (Printf.sprintf "Hello %s!\n" name) in
    html body)

(* Run it *)
|> run

See example/example.ml for more examples.

Dependencies (6)

  1. ezjsonm >= "0.5.0"
  2. lwt_log >= "1.0.0"
  3. cohttp-lwt-unix >= "1.0.0"
  4. conduit-lwt-unix >= "1.0.0" & < "2.3.0"
  5. dune
  6. ocaml >= "4.03.0"

Dev Dependencies

None

Used by

None

Conflicts

None

OCaml

Innovation. Community. Security.