Mercurial Hosting > luan
annotate website/src/examples/hi2.html.luan @ 1694:09aaca079ff3
add backup script
author | Vadim Filimonov <fffilimonov@yandex.ru> |
---|---|
date | Mon, 20 Jun 2022 11:12:25 +0300 |
parents | 4c2972f4d862 |
children |
rev | line source |
---|---|
693
ca169567ce07
module URIs must now include ".luan"
Franklin Schmidt <fschmidt@gmail.com>
parents:
505
diff
changeset
|
1 local Io = require "luan:Io.luan" |
ca169567ce07
module URIs must now include ".luan"
Franklin Schmidt <fschmidt@gmail.com>
parents:
505
diff
changeset
|
2 local Http = require "luan:http/Http.luan" |
382 | 3 |
388 | 4 |
382 | 5 local function form() |
6 %> | |
1178
49cf706c326a
serve_for_nginx on port 8081
Franklin Schmidt <fschmidt@gmail.com>
parents:
1152
diff
changeset
|
7 <!doctype html> |
382 | 8 <html> |
9 <body> | |
10 <h1>Hello</h1> | |
11 <form> | |
497
55f9f74f1e55
Http.request is now pure luan
Franklin Schmidt <fschmidt@gmail.com>
parents:
495
diff
changeset
|
12 What is your name? |
388 | 13 <input name="name"> |
14 <input type=submit> | |
382 | 15 </form> |
16 </body> | |
17 </html> | |
18 <% | |
19 end | |
20 | |
503 | 21 local function hello(name) |
382 | 22 %> |
1216 | 23 <!doctype html> |
382 | 24 <html> |
25 <body> | |
26 <h1>Hello</h1> | |
27 <p>Hi <%= name %>!</p> | |
28 </body> | |
29 </html> | |
30 <% | |
31 end | |
32 | |
505
7bc63886d4f2
web page modules now return a function
Franklin Schmidt <fschmidt@gmail.com>
parents:
503
diff
changeset
|
33 return function() |
382 | 34 Io.stdout = Http.response.text_writer() |
1152
21d157b153fe
change http parameters interface
Franklin Schmidt <fschmidt@gmail.com>
parents:
693
diff
changeset
|
35 local name = Http.request.parameters.name |
382 | 36 if name == nil then |
37 form() | |
38 else | |
503 | 39 hello(name) |
382 | 40 end |
41 end |