intial-blog-setup #33

Merged
rodude123 merged 6 commits from intial-blog-setup into master 2023-06-09 14:56:34 +01:00
10 changed files with 108 additions and 4 deletions
Showing only changes of commit e82ec15504 - Show all commits

View File

@ -1,18 +1,33 @@
<?php <?php
namespace api\blog; namespace api\blog;
require_once __DIR__ . "/../utils/routesInterface.php";
require_once "blogData.php";
use api\utils\routesInterface;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\App; use Slim\App;
class blogRoutes implements \api\utils\routesInterface class blogRoutes implements routesInterface
{ {
private blogData $blogData; private blogData $blogData;
/**
* constructor used to instantiate a base blog routes, to be used in the index.php file.
* @param App $app - the slim app used to create the routes
*/
public function __construct(App $app) public function __construct(App $app)
{ {
$this->blogData = new blogData(); $this->blogData = new blogData();
$this->createRoutes($app); $this->createRoutes($app);
} }
/**
* creates the routes for the blog
* @param App $app - the slim app used to create the routes
* @return void - returns nothing
*/
public function createRoutes(App $app): void public function createRoutes(App $app): void
{ {
// TODO: Implement createRoutes() method. // TODO: Implement createRoutes() method.

3
dist/api/index.php vendored
View File

@ -10,7 +10,9 @@ require "utils/middleware.php";
require "timeline/timelineRoutes.php"; require "timeline/timelineRoutes.php";
require "project/projectRoutes.php"; require "project/projectRoutes.php";
require "user/userRoutes.php"; require "user/userRoutes.php";
require "blog/blogRoutes.php";
use api\blog\blogRoutes;
use api\project\projectRoutes; use api\project\projectRoutes;
use api\timeline\timelineRoutes; use api\timeline\timelineRoutes;
use api\user\userRoutes; use api\user\userRoutes;
@ -30,6 +32,7 @@ new middleware($app);
new timelineRoutes($app); new timelineRoutes($app);
new projectRoutes($app); new projectRoutes($app);
new blogRoutes($app);
new userRoutes($app); new userRoutes($app);
// misc routes // misc routes

View File

@ -11,11 +11,22 @@ use Slim\App;
class projectRoutes implements routesInterface class projectRoutes implements routesInterface
{ {
private projectData $projectData; private projectData $projectData;
/**
* constructor used to instantiate a base project routes, to be used in the index.php file.
* @param App $app - the slim app used to create the routes
*/
public function __construct(App $app) public function __construct(App $app)
{ {
$this->projectData = new projectData(); $this->projectData = new projectData();
$this->createRoutes($app); $this->createRoutes($app);
} }
/**
* creates the routes for the project
* @param App $app - the slim app used to create the routes
* @return void - returns nothing
*/
public function createRoutes(App $app): void public function createRoutes(App $app): void
{ {
$app->get("/projectData", function (Request $request, Response $response) $app->get("/projectData", function (Request $request, Response $response)

View File

@ -11,12 +11,22 @@ use Slim\App;
class timelineRoutes implements routesInterface class timelineRoutes implements routesInterface
{ {
private timelineData $timelineData; private timelineData $timelineData;
/**
* constructor used to instantiate a base timeline routes, to be used in the index.php file.
* @param App $app - the slim app used to create the routes
*/
public function __construct(App $app) public function __construct(App $app)
{ {
$this->timelineData = new timelineData(); $this->timelineData = new timelineData();
$this->createRoutes($app); $this->createRoutes($app);
} }
/**
* creates the routes for the timeline
* @param App $app - the slim app used to create the routes
* @return void - returns nothing
*/
public function createRoutes(App $app): void public function createRoutes(App $app): void
{ {
$app->get("/timelineData/{timeline}", function (Request $request, Response $response, array $args) $app->get("/timelineData/{timeline}", function (Request $request, Response $response, array $args)

View File

@ -11,12 +11,22 @@ use Slim\App;
class userRoutes implements routesInterface class userRoutes implements routesInterface
{ {
private userData $user; private userData $user;
/**
* constructor used to instantiate a base user routes, to be used in the index.php file.
* @param App $app - the slim app used to create the routes
*/
public function __construct(App $app) public function __construct(App $app)
{ {
$this->user = new userData(); $this->user = new userData();
$this->createRoutes($app); $this->createRoutes($app);
} }
/**
* creates the routes for the user
* @param App $app - the slim app used to create the routes
* @return void - returns nothing
*/
public function createRoutes(App $app): void public function createRoutes(App $app): void
{ {
$app->post("/user/login", function (Request $request, Response $response) $app->post("/user/login", function (Request $request, Response $response)

View File

@ -1,12 +1,33 @@
<?php <?php
namespace api\blog; namespace api\blog;
require_once __DIR__ . "/../utils/routesInterface.php";
require_once "blogData.php";
use api\utils\routesInterface;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Slim\App; use Slim\App;
class blogRoutes implements \api\utils\routesInterface class blogRoutes implements routesInterface
{ {
private blogData $blogData;
/**
* constructor used to instantiate a base blog routes, to be used in the index.php file.
* @param App $app - the slim app used to create the routes
*/
public function __construct(App $app)
{
$this->blogData = new blogData();
$this->createRoutes($app);
}
/**
* creates the routes for the blog
* @param App $app - the slim app used to create the routes
* @return void - returns nothing
*/
public function createRoutes(App $app): void public function createRoutes(App $app): void
{ {
// TODO: Implement createRoutes() method. // TODO: Implement createRoutes() method.

View File

@ -10,7 +10,9 @@ require "utils/middleware.php";
require "timeline/timelineRoutes.php"; require "timeline/timelineRoutes.php";
require "project/projectRoutes.php"; require "project/projectRoutes.php";
require "user/userRoutes.php"; require "user/userRoutes.php";
require "blog/blogRoutes.php";
use api\blog\blogRoutes;
use api\project\projectRoutes; use api\project\projectRoutes;
use api\timeline\timelineRoutes; use api\timeline\timelineRoutes;
use api\user\userRoutes; use api\user\userRoutes;
@ -30,6 +32,7 @@ new middleware($app);
new timelineRoutes($app); new timelineRoutes($app);
new projectRoutes($app); new projectRoutes($app);
new blogRoutes($app);
new userRoutes($app); new userRoutes($app);
// misc routes // misc routes

View File

@ -11,11 +11,22 @@ use Slim\App;
class projectRoutes implements routesInterface class projectRoutes implements routesInterface
{ {
private projectData $projectData; private projectData $projectData;
/**
* constructor used to instantiate a base project routes, to be used in the index.php file.
* @param App $app - the slim app used to create the routes
*/
public function __construct(App $app) public function __construct(App $app)
{ {
$this->projectData = new projectData(); $this->projectData = new projectData();
$this->createRoutes($app); $this->createRoutes($app);
} }
/**
* creates the routes for the project
* @param App $app - the slim app used to create the routes
* @return void - returns nothing
*/
public function createRoutes(App $app): void public function createRoutes(App $app): void
{ {
$app->get("/projectData", function (Request $request, Response $response) $app->get("/projectData", function (Request $request, Response $response)

View File

@ -11,12 +11,22 @@ use Slim\App;
class timelineRoutes implements routesInterface class timelineRoutes implements routesInterface
{ {
private timelineData $timelineData; private timelineData $timelineData;
/**
* constructor used to instantiate a base timeline routes, to be used in the index.php file.
* @param App $app - the slim app used to create the routes
*/
public function __construct(App $app) public function __construct(App $app)
{ {
$this->timelineData = new timelineData(); $this->timelineData = new timelineData();
$this->createRoutes($app); $this->createRoutes($app);
} }
/**
* creates the routes for the timeline
* @param App $app - the slim app used to create the routes
* @return void - returns nothing
*/
public function createRoutes(App $app): void public function createRoutes(App $app): void
{ {
$app->get("/timelineData/{timeline}", function (Request $request, Response $response, array $args) $app->get("/timelineData/{timeline}", function (Request $request, Response $response, array $args)

View File

@ -11,12 +11,22 @@ use Slim\App;
class userRoutes implements routesInterface class userRoutes implements routesInterface
{ {
private userData $user; private userData $user;
/**
* constructor used to instantiate a base user routes, to be used in the index.php file.
* @param App $app - the slim app used to create the routes
*/
public function __construct(App $app) public function __construct(App $app)
{ {
$this->user = new userData(); $this->user = new userData();
$this->createRoutes($app); $this->createRoutes($app);
} }
/**
* creates the routes for the user
* @param App $app - the slim app used to create the routes
* @return void - returns nothing
*/
public function createRoutes(App $app): void public function createRoutes(App $app): void
{ {
$app->post("/user/login", function (Request $request, Response $response) $app->post("/user/login", function (Request $request, Response $response)