1
|
<?php
|
2
|
|
3
|
/*
|
4
|
|--------------------------------------------------------------------------
|
5
|
| Application Routes
|
6
|
|--------------------------------------------------------------------------
|
7
|
|
|
8
|
| Here is where you can register all of the routes for an application.
|
9
|
| It is a breeze. Simply tell Lumen the URIs it should respond to
|
10
|
| and give it the Closure to call when that URI is requested.
|
11
|
|
|
12
|
*/
|
13
|
|
14
|
$apiUrlRoot='/api/v1/';
|
15
|
|
16
|
/**
|
17
|
* Welcome endpoint.
|
18
|
*/
|
19
|
$app->get('/', function () {
|
20
|
return 'Welcome.';
|
21
|
});
|
22
|
|
23
|
/**
|
24
|
* Vrati seznam mericich zarizeni.
|
25
|
*/
|
26
|
$app->get($apiUrlRoot.'devices', [
|
27
|
'middleware' => ['cors', 'jwtauth'],
|
28
|
'uses' => 'DeviceController@getDevice'
|
29
|
]);
|
30
|
|
31
|
|
32
|
/**
|
33
|
* Vrati zaznamy o doprav e za casovy usek pro dane zarizeni.
|
34
|
*/
|
35
|
$app->get($apiUrlRoot.'devices/{id}', [
|
36
|
'middleware' => ['cors', 'jwtauth'],
|
37
|
'uses' => 'DeviceController@getDeviceByIdWithTraffic'
|
38
|
]);
|
39
|
|
40
|
$app->get($apiUrlRoot.'devices/{id}/csv', [
|
41
|
'middleware' => 'jwtauth',
|
42
|
'uses' => 'DeviceController@getDeviceByIdAsCsv'
|
43
|
]);
|
44
|
|
45
|
/**
|
46
|
* Vrati prumery dopravy pro danze zarizeni za casovy usek.
|
47
|
*/
|
48
|
$app->get($apiUrlRoot.'devices/{id}/time-period', [
|
49
|
'middleware' => ['cors', 'jwtauth'],
|
50
|
'uses' => 'DeviceController@getTrafficAverageByDevice'
|
51
|
]);
|
52
|
|
53
|
|
54
|
/**
|
55
|
* Vrati vsechny typy aut.
|
56
|
*/
|
57
|
$app->get($apiUrlRoot.'vehicles', [
|
58
|
'middleware' => ['cors', 'jwtauth'],
|
59
|
'uses' => 'VehicleController@getAll'
|
60
|
]);
|
61
|
|
62
|
/**
|
63
|
* Vrati vsechna mesta.
|
64
|
*/
|
65
|
$app->get($apiUrlRoot.'cities', [
|
66
|
'middleware' => ['cors', 'jwtauth'],
|
67
|
'uses' => 'LocationController@getCities'
|
68
|
]);
|
69
|
|
70
|
/**
|
71
|
* Vygeneruje novy JWT s omezenou platnosti.
|
72
|
*/
|
73
|
$app->get($apiUrlRoot.'token', 'TokenController@generateToken');
|
74
|
|
75
|
|
76
|
|
77
|
// testovani
|
78
|
$app->get($apiUrlRoot.'header', 'DeviceController@headerTest');
|