File tree Expand file tree Collapse file tree 1 file changed +20
-14
lines changed Expand file tree Collapse file tree 1 file changed +20
-14
lines changed Original file line number Diff line number Diff line change 1
1
--
2
2
-- For use with Algernon / Lua
3
- --
3
+ --
4
4
-- Project page: https://github.com/xyproto/algernon
5
5
-- Web page: http://algernon.roboticoverlords.org/
6
6
--
7
7
8
- -- Set the headers
9
- content (" application/javascript" )
10
- setheader (" Cache-Control" , " no-cache" )
8
+ handle (" /comments.json" , function ()
9
+
10
+ -- Set the headers
11
+ content (" application/javascript" )
12
+ setheader (" Cache-Control" , " no-cache" )
13
+
14
+ -- Use a JSON file for the comments
15
+ comments = JFile (" comments.json" )
16
+
17
+ -- Handle requests
18
+ if method () == " POST" then
19
+ -- Add the form data table to the JSON document
20
+ comments :add (ToJSON (formdata ()))
21
+ else
22
+ -- Return the contents of the JSON file
23
+ print (tostring (comments ))
24
+ end
11
25
12
- -- Use a JSON file for the comments
13
- comments = JFile (" comments.json" )
26
+ end )
14
27
15
- -- Handle requests
16
- if method () == " POST" then
17
- -- Add the form data table to the JSON document
18
- comments :add (ToJSON (formdata ()))
19
- else
20
- -- Return the contents of the JSON file
21
- print (tostring (comments ))
22
- end
28
+ servedir (" /" , " public" )
You can’t perform that action at this time.
0 commit comments