Hi Colin,
Is it possible with restxq to add a document to a db? And if so, to also return an http response?
sure; you need to mark your function as updating, and the db:output() function will allow you to return data. Your updated example is shown below.
Hope this helps, Christian ___________________________________
module namespace page = 'http://basex.org/modules/web-page';
declare %updating %restxq:path("form/") %restxq:POST %restxq:form-param("content","{$form-input}", "'no message delivered'") function page:add-doc($form-input as xs:string) {
let $new-doc:= <root> <tag> <form-data>{ $form-input }</form-data> </tag> </root>
return ( db:add("test_db", $new-doc, "test.xml"), db:output("database was updated.") ) };