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 3292397 commit 0138d00Copy full SHA for 0138d00
server.rb
@@ -16,7 +16,7 @@
16
puts "Server started: http://localhost:#{port}/"
17
18
root = File.expand_path './public'
19
-server = WEBrick::HTTPServer.new :Port => port, :DocumentRoot => root
+server = WEBrick::HTTPServer.new Port: port, DocumentRoot: root
20
21
server.mount_proc '/comments.json' do |req, res|
22
comments = JSON.parse(File.read('./comments.json'))
@@ -28,7 +28,7 @@
28
comment[key] = value.force_encoding('UTF-8')
29
end
30
comments << comment
31
- File.write('./comments.json', JSON.pretty_generate(comments, :indent => ' '))
+ File.write('./comments.json', JSON.pretty_generate(comments, indent: ' '))
32
33
34
# always return json
@@ -37,6 +37,6 @@
37
res.body = JSON.generate(comments)
38
39
40
-trap 'INT' do server.shutdown end
+trap('INT') { server.shutdown }
41
42
server.start
0 commit comments