forked from rmaake1/httpstatuses
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
28 lines (20 loc) · 826 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
<?php
require 'vendor/autoload.php';
require 'lib/Httpstatuses/Httpstatuses.php';
$klein = new \Klein\Klein();
$httpstatuses = new \Httpstatuses\httpstatuses();
$klein->respond('GET', '/', function ($request, $response, $service) use ($httpstatuses) {
$class_list = $httpstatuses->statuses();
$service->render('views/index.php', array("class_list" => $class_list));
});
$klein->respond('GET', '/[i:id]', function ($request, $response, $service) use ($httpstatuses) {
$status_code = $request->param('id');
$code = $httpstatuses->status($status_code);
if (!$code)
$service->render('views/404.php');
$service->render('views/status_code.php', $code);
});
$klein->respond('GET', '404', function ($request, $response, $service) {
$service->render('views/404.php');
});
$klein->dispatch();