1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-23 05:16:03 +02:00

feat(core): create api routes #159

This commit is contained in:
Awilum
2020-01-02 21:42:58 +03:00
parent 113c1cb575
commit b9a7d7f914
2 changed files with 32 additions and 1 deletions

View File

@@ -126,9 +126,10 @@ include_once 'dependencies.php';
include_once 'middlewares.php';
/**
* Include Routes (web)
* Include Routes (web, api)
*/
include_once 'routes/web.php';
include_once 'routes/api.php';
/**

30
flextype/routes/api.php Normal file
View File

@@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
/**
* Flextype (http://flextype.org)
* Founded by Sergey Romanenko and maintained by Flextype Community.
*/
namespace Flextype;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
$app->get('/api/entries', function (Request $request, Response $response, array $args) use ($flextype) {
// Get Query Params
$query = $request->getQueryParams();
//
if (!isset($query['auth_token'])) {
return $response->withJson(["detail" => "Incorrect authentication credentials."]);
}
// Response data
$data = [];
// Return response
return $response->withJson($data);
});