intial-blog-setup #33
17
dist/api/blog/blogRoutes.php
vendored
17
dist/api/blog/blogRoutes.php
vendored
@ -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
3
dist/api/index.php
vendored
@ -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
|
||||||
|
11
dist/api/project/projectRoutes.php
vendored
11
dist/api/project/projectRoutes.php
vendored
@ -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)
|
||||||
|
10
dist/api/timeline/timelineRoutes.php
vendored
10
dist/api/timeline/timelineRoutes.php
vendored
@ -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)
|
||||||
|
10
dist/api/user/userRoutes.php
vendored
10
dist/api/user/userRoutes.php
vendored
@ -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)
|
||||||
|
@ -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.
|
||||||
|
@ -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
|
||||||
|
@ -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)
|
||||||
|
@ -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)
|
||||||
|
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user