I have an Ocaml program that does its job.
Now I would like to make it deliver services over the internet as soon as possible.
I’m not experienced in the web side of an Ocaml program. I’ve just studied some tutorials.
Could you please indicate me how to setup that in a straigth manner?
I understand that I need two things:
1/ receiving http request:
- get incoming data flow from listened port
- transform (json/xml) data in OCaml values
2/ sending http request:
- transform Ocaml values in json data
- send data over http (http request targetting IP:port)
That should be pretty simple for people doing that everyday.
I see that Yojson can read a json data flow (Yojson.Basic.from_channel) and print a json data (Yojson.Basic.pretty_to_string).
So it should answer one requirement. Am I right?
I intended to wrap curl command to send request, but there should be more elegant methods.
My main question seems to be: how can I receive and send http requests using a json (or xml) object?