Fixed bugs in blog routes and added doc comments to all route files

Signed-off-by: rodude123 <rodude123@gmail.com>
This commit is contained in:
2023-06-09 14:50:20 +01:00
parent e339204bd7
commit e82ec15504
10 changed files with 108 additions and 4 deletions
+11 -1
View File
@@ -11,19 +11,29 @@ use Slim\App;
class timelineRoutes implements routesInterface
{
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)
{
$this->timelineData = new timelineData();
$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
{
$app->get("/timelineData/{timeline}", function (Request $request, Response $response, array $args)
{
//check if route is available if it is get the data
//otherwise return an error
if($args["timeline"] == "edu")
if ($args["timeline"] == "edu")
{
$response->getBody()->write(json_encode($this->timelineData->getEduData()));
return $response;