-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathroutes.php
More file actions
34 lines (27 loc) · 698 Bytes
/
routes.php
File metadata and controls
34 lines (27 loc) · 698 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
<?php
$app = new Slim();
$app->get('/', function(){
$controller = new JokeController();
$controller->index();
});
$app->get('/jokes', function(){
$controller = new JokeController();
$controller->index();
});
$app->get('/joke/:id', function($id){
$controller = new JokeController();
$controller->show($id);
});
$app->post('/jokes', function(){
$controller = new JokeController();
$controller->create();
});
$app->post('/joke/:id/up', function($id){
$controller = new JokeController();
$controller->up($id);
});
$app->post('/joke/:id/down', function($id){
$controller = new JokeController();
$controller->down($id);
});
$app->run();