This instructions can be used both in UNIX as in Windows systems (assuming you have installed Xavante using LuaForWindows and LuaRocks).

Starting Xavante using WSAPI

Xavante is an embeddable web server, which means that it is distributed as a Lua module that should be called from an application. This allows the use of more than one Xavante instance running at the same time (in different ports), each one associated with one application.

The wsapi-xavante rock installation creates an executable named wsapithat can be used to start Xavante. This executable should be called from the directory that will be considered your site root directory.

From this directory you can both execute the wsapi command to start a Xavante server with the default configuration (which is the handling of WSAPI applications, using the .lua or .ws extensions), as passing parameters to the wsapi command in order to use alternative configurations.

If you want to know more about the wsapi command, use

wsapi --help

For example, to run Xavante with Orbit Pages support (assuming that the Orbit rock is installed), you should use

wsapi --op

important: Note that the use of the --op parameter is related only to the support of Orbit Pages (which use the .op extension). Orbit applications are also WSAPI applications, so they use the same extensions as WSAPI.

Running the WSAPI applications examples with Xavante

The wsapi-xavante rock installation offers some WSAPI examples. These examples can be found at the rocks/wsapi/X.Y.Z-V/samples directory in your system (where X.Y.Z-V refers to the installed WSAPI version).

Before running the example, check if there is no other Xavante instance running and go to the WSAPI examples directory (replacing X.Y.Z-V by the correct version):

cd rocks/wsapi/X.Y.Z-V/samples

Execute now the wsapi command and check if the Xavante startup message is printed in the terminal.

If everything is fine, open the first example URL in your browser (hello.lua). This example is quite basic but it shows how a WSAPI application receives request parameters, generates the response content and finally returns the HTTP status, the HTTP headers and the content itself.

http://localhost:8080/hello.lua

You should see the following output:

Hello Wsapi!

PATH_INFO: /

SCRIPT_NAME: /hello.lua

Important: Note that the other examples in the samples directory refer to command line uses of WSAPI and should not be run through the browser.

Running Orbit examples with Xavante

To use Orbit with Xavante you will need to first install the orbit rock:

luarocks install orbit

Before executing the examples, check if there are no other Xavante instances running and go to the Orbit examples directory (replacing X.Y.Z-V by the correct version):

cd rocks/orbit/X.Y.Z-V/samples

Execute now the wsapi command and check if the Xavante startup message is printed in the terminal.

If everything is fine, proceed to the Examples page.