How to configure a “hello world” HTML page using BaseX with RestXQ?

人盡茶涼 提交于 2021-01-29 16:42:53

问题


More of a usage question than a programming question, in relation to:

BaseX RESTXQ "hello world" example

How do I use RESTXQ with BaseX for a simple web app?

basex/rest - blog complete app

Is there a way to make BaseX serve an HTML document?

Certainly, it's easy enough to fork the blog app. However, it's also eight years old.

The sample from the documentation is:

module namespace page = 'http://basex.org/examples/web-page';
declare %rest:path("hello/{$who}") %rest:GET function page:hello($who) {
  <response>
    <title>Hello { $who }!</title>
  </response>
};

where is this saved to, precisely? Is it added to a database within BaseX itself or does this exist outside as a file?


回答1:


Your hello world module should be saved in the web application directory or in a directory specify using the RESTXQPATH configuration option. BaseX scans modules in these locations, and their sub-directories, for rest:path annotations. Where the web application directory is depends on the application server and operating system you are using and on the WEBPATHconfiguration option. You can find more information in the documentation.

If you are running BaseX as a servlet then the configuration options can be set in the web.xml file as context-param entries.RESTXQPATH would be the context-param org.basex.restxqpath. There are examples in the 'Web Application' section of the BaseX documentation.



来源:https://stackoverflow.com/questions/62483897/how-to-configure-a-hello-world-html-page-using-basex-with-restxq

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!