Skip to content

Commit

Permalink
Only Read Comments File On Comments Route (reactjs#154)
Browse files Browse the repository at this point in the history
  • Loading branch information
foohyfooh authored and zpao committed Aug 21, 2016
1 parent 08115a6 commit ddc30f0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion server.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@

function routeRequest()
{
$comments = file_get_contents('comments.json');
$uri = $_SERVER['REQUEST_URI'];
if ($uri == '/') {
echo file_get_contents('./public/index.html');
} elseif (preg_match('/\/api\/comments(\?.*)?/', $uri)) {
$comments = file_get_contents('comments.json');
if($_SERVER['REQUEST_METHOD'] === 'POST') {
$commentsDecoded = json_decode($comments, true);
$commentsDecoded[] = [
Expand Down

0 comments on commit ddc30f0

Please sign in to comment.