Whenever a RESTXQ URL is requested, the [[Options#RESTXQPATH|RESTXQPATH]] module directory and its sub-directories will be scanned for functions with annotations. RESTXQ functions may occur in library modules (detected by the extension {{Code|.xqm}}) and (since {{Version|7.7}}) main modules (detected by {{Code|.xq}}). All modules will be cached and parsed again when their timestamp changes.
A simple RESTXQ module is shown below, it . It is part of a clean installation and available at http://localhost:8984/restxq/ .
<pre class="brush:xquery">(:~ derived version of the function found in http/restxq.xqm :)