-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
40 lines (33 loc) · 755 Bytes
/
index.php
File metadata and controls
40 lines (33 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
require 'libs/php/Slim/Slim.php';
$app = new Slim(array(
'templates.path' => 'src/php/views'
));
$app->get('/', function() use($app) {
$app->render('main.php');
});
$app->get('/todos', function() use($app) {
$data = array(
array(
"label" => "Task 1",
"order" => 1,
"completed" => false
),
array(
"label" => "Task 3",
"order" => 3,
"completed" => true
),
array(
"label" => "Task 2",
"order" => 2,
"completed" => false
)
);
$response = $app->response();
$response->header('Cache-Control', 'no-cache, must-revalidate');
$response->header('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT');
$response->header('Content-type', 'application/json');
echo json_encode($data);
});
$app->run();