382
|
1 local Io = require "luan:Io"
|
|
2 local Http = require "luan:web/Http"
|
|
3
|
388
|
4
|
382
|
5 local function form()
|
|
6 %>
|
|
7 <html>
|
|
8 <body>
|
|
9 <h1>Hello</h1>
|
|
10 <form>
|
388
|
11 What is you name?
|
|
12 <input name="name">
|
|
13 <input type=submit>
|
382
|
14 </form>
|
|
15 </body>
|
|
16 </html>
|
|
17 <%
|
|
18 end
|
|
19
|
|
20 local function hello()
|
|
21 %>
|
|
22 <html>
|
|
23 <body>
|
|
24 <h1>Hello</h1>
|
|
25 <p>Hi <%= name %>!</p>
|
|
26 </body>
|
|
27 </html>
|
|
28 <%
|
|
29 end
|
|
30
|
|
31 function service()
|
|
32 Io.stdout = Http.response.text_writer()
|
|
33 name = Http.request.parameters.name
|
|
34 if name == nil then
|
|
35 form()
|
|
36 else
|
|
37 hello()
|
|
38 end
|
|
39 end
|