package vif
All checked builds passInstall
dune-project
Dependency
Authors
Maintainers
Sources
sha256=98c4b7959e5a2289179e26c4c378720f4c60b920bf5be2c1c1ba8bac82b4230b
sha512=20c155e32073ccee63996f8012d1dadfae6c0f7a8f838729566d36b426a26953be94ce0edf4e6a47007f1b9b0af45a028667258d7b14bbcbc282b099feae0f33
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" ;;
let default req server () =
let field = "content-type" in
let open Vif.Response.Syntax in
let* () = Vif.Response.add ~field "text/html; charset=utf-8" in
let* () = Vif.Response.with_string req "Hello World!" in
Vif.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. A complete example of a web application that uses dune is available here. It is a summary of our tutorial available here: creating a user space with a chatroom using Vif.
Dependencies (21)
-
tyxml
>= "4.6.0" - hmap
- multipart_form-miou
- conan-database
-
conan-unix
>= "0.0.6" -
decompress
>= "1.6.0" -
mirage-crypto-rng
>= "1.2.0" -
tyre
>= "1.0" -
httpcats
>= "0.3.0" -
cmdliner
>= "1.3.0" -
jsont
>= "0.2.0" -
fluxt
>= "0.0.1~beta2" -
flux
>= "0.0.1~beta5" - bytesrw
-
fpath
>= "0.7.3" -
logs
>= "0.9.0" -
bos
>= "0.2.1" -
fmt
>= "0.11.0" -
uri
>= "4.4.0" -
dune
>= "3.0.0" -
ocaml
>= "5.3.0"
Dev Dependencies (6)
-
brr
with-test -
caqti-driver-sqlite3
with-test -
caqti-miou
with-test -
caqti
with-test & >= "3.0.0" -
jws
with-test -
hurl
>= "0.0.1~beta2" & with-test
Optional Dependencies
None
Used by (1)
-
vifu
>= "0.0.1~beta6"
Conflicts (1)
-
result
< "1.5"
Build status
Results of building vif with each compiler on check.ci.ocaml.org, run of against opam-repository 8a77e58. 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.
| Version | OCaml 4.11 | OCaml 4.14 | OCaml 5.2 | OCaml 5.4 | OCaml 5.5 |
|---|---|---|---|---|---|
| 0.0.1~beta6 (this version) | 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