From 2294bc65825972106aff44f2ad8204c4f2af30f4 Mon Sep 17 00:00:00 2001 From: Stanisław Zagórowski Date: Fri, 12 Jan 2024 18:44:38 +0100 Subject: luax: initial --- luax/reluax.luax | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 luax/reluax.luax (limited to 'luax/reluax.luax') diff --git a/luax/reluax.luax b/luax/reluax.luax new file mode 100644 index 0000000..ebe1f21 --- /dev/null +++ b/luax/reluax.luax @@ -0,0 +1,48 @@ +local Common = require("common") +local Navbar = require("components.navbar") +local AnimatedBg = require("components.animated_bg") + +local Home = require("pages.home") +local Projects = require("pages.projects") +local Games = require("pages.games") +local Contact = require("pages.contact") +local Article = require("pages.article") +local NotFound = require("not_found") + +math.randomseed(os.time()) + +local function wrap_component(component) + return + + +
+
+ {$ component $} + +
+
+end + +local function route(path) + if path == '/' then + return 200, wrap_component() + elseif path == '/projects' then + return 200, wrap_component() + elseif path == '/games' then + return 200, wrap_component() + elseif path == '/contact' then + return 200, wrap_component() + elseif reluax.url_matches('/article/{title}', path) then + local title = reluax.url_extract('/article/{title}', path).title + local article =
+ return 200, article + end + + return 404, NotFound() +end + +return { + name = "hello-world", + route = route +} + -- cgit v1.3.1