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:
Vendored
+11
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user