Skip to content

Instantly share code, notes, and snippets.

@apb2006
Created July 21, 2016 11:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apb2006/1076f62e36055ab1b5f9755a7f8c9172 to your computer and use it in GitHub Desktop.
Save apb2006/1076f62e36055ab1b5f9755a7f8c9172 to your computer and use it in GitHub Desktop.
BaseX RESTXQ Content Negotiation
module namespace page = 'http://basex.org/modules/web-page';
declare
%rest:path("content")
%rest:produces("application/json")
%output:method("json")
function page:content1(){
<json type="object">
<msg>Hello</msg>
</json>
};
declare
%rest:path("content")
%rest:produces("text/html")
%output:method("html")
function page:content2(){
<div>hello</div>
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment