From b9a7d7f91497a9f0aeec28aa620b6b979c5e9dc3 Mon Sep 17 00:00:00 2001 From: Awilum Date: Thu, 2 Jan 2020 21:42:58 +0300 Subject: [PATCH] feat(core): create api routes #159 --- flextype/bootstrap.php | 3 ++- flextype/routes/api.php | 30 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 flextype/routes/api.php diff --git a/flextype/bootstrap.php b/flextype/bootstrap.php index 8f652f45..729cea7c 100755 --- a/flextype/bootstrap.php +++ b/flextype/bootstrap.php @@ -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'; /** diff --git a/flextype/routes/api.php b/flextype/routes/api.php new file mode 100644 index 00000000..db19cc96 --- /dev/null +++ b/flextype/routes/api.php @@ -0,0 +1,30 @@ +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); +});