This repository was archived by the owner on Jul 19, 2019. It is now read-only.
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 11--
22-- For use with Algernon / Lua
3- --
3+ --
44-- Project page: https://github.com/xyproto/algernon
55-- Web page: http://algernon.roboticoverlords.org/
66--
77
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
1125
12- -- Use a JSON file for the comments
13- comments = JFile (" comments.json" )
26+ end )
1427
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