3 ms·
I want to serve a JSON response over HTTP, preferably from a standalone server (like django etc). Later I want to talk to Postgres and memcached. Do I use this
by peterhunt 12y ago
I want to serve a JSON response over HTTP, preferably from a standalone server (like django etc). Later I want to talk to Postgres and memcached.
Do I use this thing? http://ocsigen.org/ocsigenserver/ http://ocsigen.org/ocsigenserver/ All the docs either don't do what I'm looking for (i.e set up a web server to serve some static files) or are broken links!
OCaml is actually what I'd prefer to use (since I had a blast with SML/NJ)
I'll check out that book, thanks! But I did just skim the ToC and it has nothing about serving HTTP. Serving HTTP is like my #1 use case for anything these days :/
- lpw25 12y agoI think all the pieces are there to do that (e.g. cohttp, yojson, atdgen, PG'OCaml), although perhaps not in a single easy to use framework. Maybe http://rgrinberg.com/blog/2014/04/04/introducing-opium/ http://rgrinberg.com/blog/2014/04/04/introducing-opium/ is relevant.
- djs55 12y agoFor HTTP I always use 'ocaml-cohttp' (opam install cohttp): https://github.com/mirage/ocaml-cohttp/blob/master/examples/async/hello_world.ml https://github.com/mirage/ocaml-cohttp/blob/master/examples/... For JSON I normally use 'Jsonm' but I've heard good things about 'Ezjsonm': https://github.com/samoht/ezjsonm https://github.com/samoht/ezjsonm I've not personally tried them but 'postgresql-ocaml' and 'ocaml-memcached' look plausible.