From 0cc1ef7105964645500e1113be908fdc50e9d89c Mon Sep 17 00:00:00 2001 From: Stanisław Zagórowski Date: Fri, 19 Jan 2024 23:17:28 +0100 Subject: example: add basic, move hello world into its own dir --- example/basic/reluax.luax | 20 ++++++++++++++++++++ example/hello-world/index.luax | 14 ++++++++++++++ example/hello-world/reluax.luax | 24 ++++++++++++++++++++++++ example/index.luax | 14 -------------- example/reluax.luax | 24 ------------------------ 5 files changed, 58 insertions(+), 38 deletions(-) create mode 100644 example/basic/reluax.luax create mode 100644 example/hello-world/index.luax create mode 100644 example/hello-world/reluax.luax delete mode 100644 example/index.luax delete mode 100644 example/reluax.luax diff --git a/example/basic/reluax.luax b/example/basic/reluax.luax new file mode 100644 index 0000000..bba3e1a --- /dev/null +++ b/example/basic/reluax.luax @@ -0,0 +1,20 @@ +local route = function(path) + if path == '/' then + return 200, + + + basic-example + + +

This is the simplest example of a Reluax application.

+ + + end + + return 404, 'Not Found' +end + +return { + name = 'basic-example', + route = route +} 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 + + Reluax + + +

Reluax Test

+

Random number for you: {$ tostring(math.floor(math.random() * 100)) $}

+

+ What font size is this? +

+ + +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, + + Error 404 + + +

Error 404

+

Page not found.

+ + +end + +return { + name = "hello-world", + route = route +} diff --git a/example/index.luax b/example/index.luax deleted file mode 100644 index 3dff259..0000000 --- a/example/index.luax +++ /dev/null @@ -1,14 +0,0 @@ -return function() - return - - Reluax - - -

Reluax Test

-

Random number for you: {$ tostring(math.floor(math.random() * 100)) $}

-

- What font size is this? -

- - -end diff --git a/example/reluax.luax b/example/reluax.luax deleted file mode 100644 index 2562fb1..0000000 --- a/example/reluax.luax +++ /dev/null @@ -1,24 +0,0 @@ -local index = require("index") - -math.randomseed(os.time()) - -local function route(path) - if path == '/' then - return 200, index() - end - - return 404, - - Error 404 - - -

Error 404

-

Page not found.

- - -end - -return { - name = "hello-world", - route = route -} -- cgit v1.3.1