package yurt

  1. Overview
  2. Docs
An HTTP framework for OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

v0.5.tar.gz
sha256=3626b904493627bc39632861e192487685f106ab4cf589bc52b38ca3f2fe1b48
md5=8b5bab07d30fed735101a0f3a7fdfedb

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 Jan 2018

README

Yurt

yurt is an HTTP microframework for OCaml based on Cohttp.

Features

  • Simple API

  • Multipart forms

  • Regex based URL routing

  • Code-based templates

Installation

opam install yurt

Usage

open Yurt.Server
open Yurt.Route

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

(* Add a handler *)
>| get "/<name:string>" (fun req params body ->
    let body = Yurt_html.h1 ("Hello " ^ param_string params "name") in
    respond_html ~status:`OK ~body ())

(* Run it *)
|> run

See example/example.ml for more examples.

Dependencies (8)

  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. topkg build
  6. ocamlbuild build
  7. ocamlfind build
  8. ocaml >= "4.03.0"

Dev Dependencies

None

Used by

None

Conflicts

None

OCaml

Innovation. Community. Security.