diff options
| author | Stanisław Zagórowski <hasohasacz@gmail.com> | 2024-01-19 23:17:28 +0100 |
|---|---|---|
| committer | Stanisław Zagórowski <hasohasacz@gmail.com> | 2024-01-19 23:17:28 +0100 |
| commit | 0cc1ef7105964645500e1113be908fdc50e9d89c (patch) | |
| tree | ae0394eddfa45b8290fdb73a41ebbbb7db7f17f1 /example/hello-world | |
| parent | 3e73bbaf796a080412c8368a821eb44b1371d761 (diff) | |
example: add basic, move hello world into its own dir
Diffstat (limited to 'example/hello-world')
| -rw-r--r-- | example/hello-world/index.luax | 14 | ||||
| -rw-r--r-- | example/hello-world/reluax.luax | 24 |
2 files changed, 38 insertions, 0 deletions
diff --git a/example/hello-world/index.luax b/example/hello-world/index.luax new file mode 100644 index 0000000..3dff259 --- /dev/null +++ b/example/hello-world/index.luax @@ -0,0 +1,14 @@ +return function() + return <html> + <head> + <title>Reluax</title> + </head> + <body> + <h1>Reluax Test</h1> + <p>Random number for you: {$ tostring(math.floor(math.random() * 100)) $}</p> + <p style={ "font-size: " .. tostring(math.floor(math.random() * 100)) .. 'px' }> + What font size is this? + </p> + </body> + </html> +end diff --git a/example/hello-world/reluax.luax b/example/hello-world/reluax.luax new file mode 100644 index 0000000..2562fb1 --- /dev/null +++ b/example/hello-world/reluax.luax @@ -0,0 +1,24 @@ +local index = require("index") + +math.randomseed(os.time()) + +local function route(path) + if path == '/' then + return 200, index() + end + + return 404, <html> + <head> + <title>Error 404</title> + </head> + <body> + <h1>Error 404</h1> + <p>Page not found.</p> + </body> + </html> +end + +return { + name = "hello-world", + route = route +} |
