Ocsigen/Eliom tutorial从一个提供“Hello, world!”的应用程序示例开始。作为 HTML:
open Eliom_content.Html5.D
let main_service =
Eliom_registration.Html5.register_service
~path:["graff"]
~get_params:Eliom_parameter.unit
(fun () () ->
Lwt.return
(html
(head (title (pcdata "Page title")) [])
(body [h1 [pcdata "Graffiti"]])))
如何将其作为 JSON 来提供呢?具体来说,如何注册 JSON 服务,以及应该使用哪些库/组合器来生成/序列化 JSON(js_of_ocaml?)?
最佳答案
关于ocaml - 使用 Ocsigen 提供 JSON 的规范方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17076575/