Create a basic structure to fetch the api version

Signed-off-by: Christian Wolf <github@christianwolf.email>
This commit is contained in:
Christian Wolf 2021-01-09 18:13:57 +01:00
Родитель 50dcd5edac
Коммит 8c5f42bd2b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 9FC3120E932F73F1
2 изменённых файлов: 17 добавлений и 0 удалений

Просмотреть файл

@ -9,6 +9,7 @@
*/ */
return [ return [
'routes' => [ 'routes' => [
['name' => 'main#getApiVersion', 'url' => '/api/version', 'verb' => 'GET'],
['name' => 'main#index', 'url' => '/', 'verb' => 'GET'], ['name' => 'main#index', 'url' => '/', 'verb' => 'GET'],
['name' => 'main#home', 'url' => '/home', 'verb' => 'GET'], ['name' => 'main#home', 'url' => '/home', 'verb' => 'GET'],
['name' => 'main#keywords', 'url' => '/keywords', 'verb' => 'GET'], ['name' => 'main#keywords', 'url' => '/keywords', 'verb' => 'GET'],

Просмотреть файл

@ -55,6 +55,22 @@ class MainController extends Controller {
return new TemplateResponse($this->appName, 'index', $view_data); // templates/index.php return new TemplateResponse($this->appName, 'index', $view_data); // templates/index.php
} }
/**
* @NoAdminRequired
* @NoCSRFRequired
* @return DataResponse
*/
public function getApiVersion(): DataResponse {
$response = [
'cookbook_version' => [0,7,7], /* VERSION_TAG */
'api_version' => [
'major' => 0,
'minor' => 1
]
];
return new DataResponse($response, 200, ['Content-Type' => 'application/json']);
}
/** /**
* @NoAdminRequired * @NoAdminRequired