-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
60 lines (53 loc) · 849 Bytes
/
index.php
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
/**
* Slim Starter v1
*/
require 'vendor/autoload.php';
require 'config.php';
require 'Database.php';
require 'Debug.php';
require 'Users.php';
// @todo autoload classes
/**
* Create app
*/
$app = new \Slim\Slim();
/**
* Routes
*/
$app->get('/', 'hello');
$app->post('/users', 'Users::create');
$app->get('/users', 'Users::getAll');
$app->get('/users/:id', 'Users::get');
$app->group('/user', function() use ($app) {
$app->get('/:id', 'Users::get');
});
/**
* Run app
*/
$app->run();
/**
* Hello
*/
function hello() {
$template = <<<EOT
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Slim Starter v1</title>
<style>
body {
background: #EDEDED;
color: #A8A8A8;
text-align: center;
}
</style>
</head>
<body>
<h1>Slim Starter v1</h1>
</body>
</html>
EOT;
echo $template;
}