Tuesday, August 16, 2011

how to get xavante to serve static files

on archlinux install lua and luarocks
# pacman -S lua luarocks
# luarocks install xavante
now copy this script and chmod 700 it
# cat xav.lua
#!/usr/bin/lua

require "xavante"
require "xavante.filehandler"
local webDir = "/home/g"
local simplerules = {

{ -- filehandler example
match = ".",
with = xavante.filehandler,
params = {baseDir = webDir}
},
}
xavante.HTTP{
server = {host = "*", port = 8080},

defaultHost = {
rules = simplerules
},
}
xavante.start()

# ./xav.lua
Xavante started on port(s) 8080

in seamonkey: localhost:8080/index.html shows my little custom html page yay!

note: unlike dustmote/tcl combo localhost:8080 caused a redirect loop, you need to feed xavante a filename, it wont default to index.html

No comments: