{"action":"created","issue":{"url":"https://api.github.com/repos/reactjs/react-tutorial/issues/17","labels_url":"https://api.github.com/repos/reactjs/react-tutorial/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/reactjs/react-tutorial/issues/17/comments","events_url":"https://api.github.com/repos/reactjs/react-tutorial/issues/17/events","html_url":"https://github.com/reactjs/react-tutorial/pull/17","id":55196561,"number":17,"title":"server.js updates comments variable after get request to \"comments.json\"","user":{"login":"ASwitlyk","id":7741426,"avatar_url":"https://avatars.githubusercontent.com/u/7741426?v=3","gravatar_id":"","url":"https://api.github.com/users/ASwitlyk","html_url":"https://github.com/ASwitlyk","followers_url":"https://api.github.com/users/ASwitlyk/followers","following_url":"https://api.github.com/users/ASwitlyk/following{/other_user}","gists_url":"https://api.github.com/users/ASwitlyk/gists{/gist_id}","starred_url":"https://api.github.com/users/ASwitlyk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ASwitlyk/subscriptions","organizations_url":"https://api.github.com/users/ASwitlyk/orgs","repos_url":"https://api.github.com/users/ASwitlyk/repos","events_url":"https://api.github.com/users/ASwitlyk/events{/privacy}","received_events_url":"https://api.github.com/users/ASwitlyk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-01-22T19:22:10Z","updated_at":"2015-02-02T19:51:49Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/reactjs/react-tutorial/pulls/17","html_url":"https://github.com/reactjs/react-tutorial/pull/17","diff_url":"https://github.com/reactjs/react-tutorial/pull/17.diff","patch_url":"https://github.com/reactjs/react-tutorial/pull/17.patch"},"body":"In the fetching data from the server section of the tutorial documentation, a method to poll the server is added so that the app polls the server every 2 seconds for changes to the server's _comments.json data (which will then reflected through dynamic updates to the DOM). Section of tutorial below:\r\n\r\n![screen shot 2015-01-22 at 11 15 11 am](https://cloud.githubusercontent.com/assets/7741426/5862567/cf4cf890-a227-11e4-8e71-d24ae9f3dfce.png)\r\n\r\nHere, in the tutorial, after adding the server polling it encourages you to change the _comments.json file so that you can see the app dynamically change when new information is obtained from the server.\r\n\r\nThe server file is setup to just fetch json data from a static file (_comments.json) by reading the file and then storing the contents of the file in a variable 'comments'. Then on a get requests to comments.json, the server sends the stringified comments data as a response. The problem is that the _comments.json file is currently only read one time by the server and never reread, so changes to the _comments.json file never change the comments variable. \r\n\r\nThis push request updates the server.js file so that the server will re-read the _comments.json file and update the comments variable after every get request to comments.json. "},"comment":{"url":"https://api.github.com/repos/reactjs/react-tutorial/issues/comments/72524956","html_url":"https://github.com/reactjs/react-tutorial/pull/17#issuecomment-72524956","issue_url":"https://api.github.com/repos/reactjs/react-tutorial/issues/17","id":72524956,"user":{"login":"zpao","id":8445,"avatar_url":"https://avatars.githubusercontent.com/u/8445?v=3","gravatar_id":"","url":"https://api.github.com/users/zpao","html_url":"https://github.com/zpao","followers_url":"https://api.github.com/users/zpao/followers","following_url":"https://api.github.com/users/zpao/following{/other_user}","gists_url":"https://api.github.com/users/zpao/gists{/gist_id}","starred_url":"https://api.github.com/users/zpao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zpao/subscriptions","organizations_url":"https://api.github.com/users/zpao/orgs","repos_url":"https://api.github.com/users/zpao/repos","events_url":"https://api.github.com/users/zpao/events{/privacy}","received_events_url":"https://api.github.com/users/zpao/received_events","type":"User","site_admin":false},"created_at":"2015-02-02T19:51:49Z","updated_at":"2015-02-02T19:51:49Z","body":"Ah, it looks like our bot wasn't set up right for this repo. Can you sign the CLA - https://code.facebook.com/cla - and then this is good to go."}}