blob: 6cd494977a8e084c33108f7439170ab932fb79fe (
plain) (
blame)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
|
local Common = require("common")
local Footer = require("components.footer")
local AnimatedBg = require("components.animated_bg")
local Home = require("pages.home")
local NotFound = require("not_found")
math.randomseed(os.time())
local wrap_component = function(component)
return
<Common>
<div class="back-shadows"></div>
<div id="app-main">
{$ component $}
<AnimatedBg />
</div>
<Footer />
</Common>
end
local visits = 0
local route = function(path, method, headers, body)
if method ~= 'GET' then
return 405, "Method not allowed"
end
if path == '/' then
visits = visits + 1
return 200, wrap_component(<Home visits={visits}/>)
end
return 404, NotFound()
end
return {
name = "rem.duckonaut.dev",
route = route
}
|