module Service:SERVICEwith type data = unit
Default SERVICE module suitable for Make. The main function just raises
a Types.Server_exn, but this module can be usefully included in your own
SERVICE module to get defaults for other values that are at least usable for
development. (More such values are expected soon.)
type data
val version : (string * string) listType of version information, displayed by the version subcommand.
This is an alist. It is displayed on stdout, one line per pair, as two tab-separated fields per line, first the key and then the value.
You MAY put any values in here that you like, but there are several conventional values that you SHOULD provide.
| KEY | VALUE |
|---------+---------------------------------------|
| name | the name of the application / service |
| version | the version number |
| ident | a revision-control system identifier |
| author | the author's name (email address) |
| www | url for the application home page |
| | (for distribution / documentation, |
| | not for the service) |
|---------+---------------------------------------|
val init : string list -> dataType of service initialization function. Takes a processed
argv parameter that contains just your application-specific
command line options (if any). (If you want to examine the
entire argv, including Restful-specific options, just use
Sys.argv instead.) Returns a value of type Restful.SERVICE.data, which will
be passed as a parameter to your Restful.SERVICE.main function.
init is called exactly once, when the service starts up: not
once per client request (except, of course, in CGI mode, where
each request restarts the service).
val main : Restful.Types.mode ->
data -> Netcgi.cgi -> Nethttp.http_statusType of function that implements a service. Takes a
Types.mode, which is for your service to inspect, if desired;
a parameter of arbitrary data (typically used to pass in data that you
initialize once, at the time the service starts up, rather than once per request);
a string list representing the runtime argv of the process (cleaned up to remove
the leading parameters that Restful itself requires, leaving only
those that you have decided to use yourself);
and a CGI activation object. Typically will ultimately call
Restful.Content.write or the like to implement your service. Returns a
Nethttp.http_status value; simply returning the value of
Content.write is the most common way to do this.