We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1b3542d commit 5ed1252Copy full SHA for 5ed1252
server.lua
@@ -9,14 +9,14 @@
9
content("application/javascript")
10
setheader("Cache-Control", "no-cache")
11
12
--- Use a Redis list for the comments
13
-comments = List("comments")
+-- Use a JSON file for the comments
+comments = JFile("comments.json")
14
15
-- Handle requests
16
if method() == "POST" then
17
- -- Add the form data to the comment list, as JSON
18
- comments:add(JSON(formdata()))
+ -- Add the form data table to the JSON document
+ comments:add(ToJSON(formdata()))
19
else
20
- -- Combine all the JSON comments to a JSON document
21
- print("["..table.concat(comments:getall(), ",").."]")
+ -- Return the contents of the JSON file
+ print(tostring(comments))
22
end
0 commit comments