Modified mithril.html

Added controller for API requests
This commit is contained in:
2017-09-27 16:17:03 +07:00
parent 35d70443be
commit 7c61498047
2 changed files with 57 additions and 20 deletions

32
App/Controllers/Api.php Normal file
View File

@@ -0,0 +1,32 @@
<?php
namespace App\Controllers;
use Core\Token;
class Api
{
public function posts() {
$get = [
'data' => [
[
'id' => 1,
'judul' => 'post_1',
'status' => 1
],
[
'id' => 2,
'judul' => 'post_2',
'status' => 0
],
[
'id' => 3,
'judul' => 'post_3',
'status' => 2
]
]
];
$get['count'] = count($get['data']);
header('Content-Type: application/json');
echo json_encode($get);
}
}