http = {} http.bind = "localhost:8080" http.root = "/tmp/www" http.handlers = {} http.handlers["GET"] = function(request) if string.match(request.path, "^/lua") then local payload = "hello world" return { handler = "lua", status = 200, content = payload, headers = { ["content-type"] = "text/plain", ["content-length"] = tostring(#payload) } } else return { handler = "staticfile", path = string.format("%s/%s", http.root, request.path), mime = "text/plain" } end end