package vif

Build not checked
  1. Overview
  2. Docs
A simple web framework for OCaml 5

Install

dune-project
 Dependency

Authors

Maintainers

Sources

vif-0.0.1.beta1.tbz
sha256=fc6c97461e5f4f770af2653beecc5323e35d114270470df18004be0835048bbf
sha512=ed503ae8f3130705058f994e12520d2da856f53dcd4e85e4e441d9d2db9471d0be4344eb7fe34c254ddfdefddf0169b132522e0091277d29c5ac7d6ffcf6f5fc

Description

Added to opam-repository:

README

νιϝ, a small framework for building a web server from an OCaml script

(nu)(iota)(digamma)

disclaimer: Please note that this is an experimental project. It's also an opportunity to build something that can be satisfying for web development. However, we do not recommend using this project in production.

Vif is a small program that runs an OCaml script and launches a Web server from it. The main idea is to be able to set up a typed Web server as quickly as possible (note that we use hurl, an HTTP client in OCaml)

$ opam pin add -y https://github.com/robur-coop/vif
$ opam pin add -y https://github.com/robur-coop/hurl
$ opam install vif hurl
$ cat >main.ml <<EOF
#require "vif" ;;

open Vif ;;

let default req server () =
  let field = "content-type" in
  let* () = Response.add ~field "text/html; charset=utf-8" in
  let* () = Response.with_string req "Hello World!" in
  Response.respond `OK
;;

let routes =
  let open Vif.Uri in
  let open Vif.Route in
  [ get (rel /?? nil) --> default ]

let () =
  Miou_unix.run @@ fun () ->
  Vif.run routes ()
;;
EOF
$ vif --pid vif.pid main.ml &
$ hurl http://localhost:8080/
HTTP/1.1 200 OK

connection: close
content-length: 12
content-type: text/html

Hello World!

$ kill -SIGINT $(cat vid.pid)

Examples

The examples folder contains several examples of the use of vif. It shows the management of more complex requests (json, multipart-form, etc.) as well as the use of an SQL database with caqti.

Dependencies (20)

  1. tyxml >= "4.6.0"
  2. hmap
  3. multipart_form-miou
  4. conan-database
  5. conan-unix >= "0.0.6"
  6. decompress >= "1.5.0"
  7. jsonm >= "1.0.2"
  8. mirage-crypto-rng-miou-unix
  9. tyre >= "0.5" & < "1.0"
  10. httpcats >= "0.1.0" & < "0.3.0"
  11. cmdliner >= "1.3.0"
  12. jsont >= "0.2.0"
  13. bytesrw
  14. fpath >= "0.7.3"
  15. logs >= "0.9.0"
  16. bos >= "0.2.1" & < "0.3.0"
  17. fmt >= "0.11.0"
  18. uri >= "4.4.0"
  19. dune >= "3.0.0"
  20. ocaml >= "5.3.0"

Dev Dependencies (1)

  1. hurl with-test

Optional Dependencies

None

Used by

None

Conflicts (1)

  1. result < "1.5"

Build status

Results of building vif with each compiler on check.ci.ocaml.org, run of against opam-repository 78c202b. All results for this package.

Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.

This version is not in the latest run; the versions below are.

Version OCaml 4.11 OCaml 4.14 OCaml 5.2 OCaml 5.4 OCaml 5.5
0.0.1~beta6 n/a n/a n/a good good
  • good Package successfully built
  • partial One of the dependencies failed to build
  • bad Package failed to build
  • n/a Package is not available in this environment
  • internal Internal failure