The OpenD Programming Language

serveApi

Serves a class' methods, as a kind of low-state RPC over the web. To be used with dispatcher.

Usage of this function will add a dependency on arsd.dom and arsd.jsvar unless you have overriden the presenter in the dispatcher.

FIXME: explain this better

You can overload functions to a limited extent: you can provide a zero-arg and non-zero-arg function, and non-zero-arg functions can filter via UDAs for various http methods. Do not attempt other overloads, the runtime result of that is undefined.

A method is assumed to allow any http method unless it lists some in UDAs, in which case it is limited to only those. (this might change, like maybe i will use pure as an indicator GET is ok. idk.)

// legal in D, undefined runtime behavior with cgi.d, it may call either method
// even if you put different URL udas on it, the current code ignores them.
void foo(int a) {}
void foo(string a) {}
version(with_breaking_cgi_features)
serveApi
(
T
)
(
string urlPrefix
)

See Also

Meta