By means of the library(spin) we wrote a HTTP server that does serve two pages /style.css and /moon.cgi. The style sheet /style.css is a static file served from the file system, it is used to give the SVG elements some styling such as a fill colour:
dispatch('/style.css', _, _, Res) :-
http_write_head(Res, 200,
['content-type'-'text/css; charset=utf-8']),
http_text_new(Res, S),
open('style.css', read, T),
Etc..
The dynamic page /moon.cgi will present the description and present the sunlit portion in a page with forward and backward links. If the day is not given in the URL query parameters it will take the current day:
dispatch('/moon.cgi', List, _, Res) :-
http_write_head(Res, 200,
['content-type'-'text/html; charset=utf-8']),
http_text_new(Res, S),
dom_output_new(S, T),
(member(day - Day2, List) ->
sys_time_atom('%Y-%m-%d', Time, Day2);
statistics(wall, Time)),
phase(Time, Phase),
Etc..
The learning curve is not extremely high, since there is no need to generate a Prolog term, that would describe the output. The developer can freely interleave output statements and computation statements. As he is most likely already used when dealing with a TTY.