moved index to controller file

master
Matt Huntington 8 years ago
parent 75ea68e51b
commit b793b2d594

@ -1,6 +1,6 @@
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^GET$
RewriteRule ^people$ index.php
RewriteRule ^people$ controllers/people.php?action=index
RewriteCond %{REQUEST_METHOD} ^DELETE$
RewriteRule ^people/([0-9]+)$ delete.php?id=$1
RewriteCond %{REQUEST_METHOD} ^POST$

@ -0,0 +1,8 @@
<?php
header('Content-Type: application/json');
include __DIR__ . '/../data/people.php';
if($_REQUEST['action'] === 'index'){
echo json_encode($people);
}
?>

@ -1,5 +1,5 @@
<?php
include 'models/person.php';
include __DIR__ . '/../models/person.php';
$people = array();
$people[] = new Person('joni', 52);

@ -1,6 +0,0 @@
<?php
header('Content-Type: application/json');
include 'data/people.php';
echo json_encode($people);
?>
Loading…
Cancel
Save