blob: ea370a9abe4a47424df4a02da83ddd710ba30d2c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
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
|