Dream OCaml
Kipande cha OCaml kwa Dream kinachojibu maombi ya /pixel.gif kwa empty GIF, ambayo husimbuliwa (decode) mara moja programu inapoanza.
Dream OCaml
(* dune: (executable (name pixel) (libraries dream base64)) *)
let gif = Base64.decode_exn "R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="
let () =
Dream.run ~interface:"0.0.0.0" ~port:8080
@@ Dream.logger
@@ Dream.router
[
Dream.get "/pixel.gif" (fun _ ->
Dream.respond
~headers:[ ("Content-Type", "image/gif"); ("Cache-Control", "no-store") ]
gif);
]
Kimelinganishwa na nyaraka za sasa za framework.
Kagua
curl -sI http://localhost:8080/pixel.gif