summaryrefslogtreecommitdiff
path: root/reluax.luax
blob: 6845de61afa2aa7d5ed36ca610e00ad2d53324ab (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
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 route = function(path, method, headers, body)
    if method ~= 'GET' then
        return 405, "Method not allowed"
    end

    if path == '/' then
        return 200, wrap_component(<Home />)
    end

    return 404, NotFound()
end

return {
    name = "rem.duckonaut.dev",
    route = route
}