Skip to content

Commit

Permalink
Merge pull request reactjs#76 from mttrs/lint-go-ruby
Browse files Browse the repository at this point in the history
Lint for go and ruby
  • Loading branch information
zpao committed Sep 10, 2015
2 parents 83e0ff4 + 0138d00 commit 2661991
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func handleComments(w http.ResponseWriter, r *http.Request) {
switch r.Method {
case "POST":
// Decode the JSON data
comments := make([]comment, 0)
var comments []comment
if err := json.Unmarshal(commentData, &comments); err != nil {
http.Error(w, fmt.Sprintf("Unable to Unmarshal comments from data file (%s): %s", dataFile, err), http.StatusInternalServerError)
return
Expand Down
6 changes: 3 additions & 3 deletions server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
puts "Server started: http://localhost:#{port}/"

root = File.expand_path './public'
server = WEBrick::HTTPServer.new :Port => port, :DocumentRoot => root
server = WEBrick::HTTPServer.new Port: port, DocumentRoot: root

server.mount_proc '/comments.json' do |req, res|
comments = JSON.parse(File.read('./comments.json'))
Expand All @@ -28,7 +28,7 @@
comment[key] = value.force_encoding('UTF-8')
end
comments << comment
File.write('./comments.json', JSON.pretty_generate(comments, :indent => ' '))
File.write('./comments.json', JSON.pretty_generate(comments, indent: ' '))
end

# always return json
Expand All @@ -37,6 +37,6 @@
res.body = JSON.generate(comments)
end

trap 'INT' do server.shutdown end
trap('INT') { server.shutdown }

server.start

0 comments on commit 2661991

Please sign in to comment.