Whenever a RESTXQ URL is requested, the [[Options#RESTXQPATH|RESTXQPATH]] module directory and its sub-directories will be parsed for library modules (detected by the extension {{Code|.xqm}}) and functions with RESTXQ annotations.
Since {{Version|7.7}}, also main modules (detected by {{Code|.xq}}) will be parsed (; the main expression of the main module will never be evaluated). All modules will be cached and parsed again when their timestamp changes.
A simple RESTXQ module is shown below. It is part of a clean installation and available at http://localhost:8984/ .