Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jul 19, 2019. It is now read-only.

Update server.php #50

Merged
merged 1 commit into from
May 12, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function routeRequest()
case '/':
echo file_get_contents('./public/index.html');
break;
case '/comments.json':
case (preg_match('/comments.json*/', $_SERVER["REQUEST_URI"]) ? true : false):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oy that's a hacky case. Let's just drop the whole switch and just use if

if($_SERVER['REQUEST_METHOD'] === 'POST') {
$commentsDecoded = json_decode($comments, true);
$commentsDecoded[] = ['author' => $_POST['author'],
Expand Down