created new App class to start up app and move off of index
parent
9283a7f5b3
commit
444189e527
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Psr\Http\Message\ResponseInterface as Response;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||||
|
use Slim\Factory\AppFactory;
|
||||||
|
use Slim\Views\Twig;
|
||||||
|
use Slim\Views\TwigMiddleware;
|
||||||
|
|
||||||
|
include "../brain/controller/RouteControl.inc.php";
|
||||||
|
include "../brain/data/Settings.inc.php";
|
||||||
|
include "../brain/data/Session.inc.php";
|
||||||
|
include "../brain/data/Member.inc.php";
|
||||||
|
include "../brain/data/Auth.inc.php";
|
||||||
|
include "../brain/data/Render.inc.php";
|
||||||
|
include "../brain/utility/StringTools.inc.php";
|
||||||
|
include "../brain/utility/FileUploader.inc.php";
|
||||||
|
include "../brain/utility/DocTools.inc.php";
|
||||||
|
include "../brain/utility/Sorting.inc.php";
|
||||||
|
|
||||||
|
class App
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$app = AppFactory::create();
|
||||||
|
$twig = Twig::create("../brain/views/");
|
||||||
|
$app->add(TwigMiddleware::create($app, $twig));
|
||||||
|
//set up routing
|
||||||
|
$app->get(
|
||||||
|
"/[{first}[/{second}[/{third}[/{fourth}]]]]",
|
||||||
|
"\RouteControl:get"
|
||||||
|
);
|
||||||
|
$app->post(
|
||||||
|
"/[{first}[/{second}[/{third}[/{fourth}]]]]",
|
||||||
|
"\RouteControl:post"
|
||||||
|
);
|
||||||
|
//start the app
|
||||||
|
|
||||||
|
$app->run();
|
||||||
|
}
|
||||||
|
}
|
@ -1,29 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
require "../vendor/autoload.php";
|
require "../vendor/autoload.php";
|
||||||
|
include "../brain/App.inc.php";
|
||||||
use Psr\Http\Message\ResponseInterface as Response;
|
new App();
|
||||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
|
||||||
use Slim\Factory\AppFactory;
|
|
||||||
use Slim\Views\Twig;
|
|
||||||
use Slim\Views\TwigMiddleware;
|
|
||||||
|
|
||||||
include "../brain/controller/RouteControl.inc.php";
|
|
||||||
include "../brain/data/Settings.inc.php";
|
|
||||||
include "../brain/data/Session.inc.php";
|
|
||||||
include "../brain/data/Member.inc.php";
|
|
||||||
include "../brain/data/Auth.inc.php";
|
|
||||||
include "../brain/data/Render.inc.php";
|
|
||||||
include "../brain/utility/StringTools.inc.php";
|
|
||||||
include "../brain/utility/FileUploader.inc.php";
|
|
||||||
include "../brain/utility/DocTools.inc.php";
|
|
||||||
include "../brain/utility/Sorting.inc.php";
|
|
||||||
|
|
||||||
$app = AppFactory::create();
|
|
||||||
$twig = Twig::create("../brain/views/");
|
|
||||||
$app->add(TwigMiddleware::create($app, $twig));
|
|
||||||
//set up routing
|
|
||||||
$app->get("/[{first}[/{second}[/{third}[/{fourth}]]]]", "\RouteControl:get");
|
|
||||||
$app->post("/[{first}[/{second}[/{third}[/{fourth}]]]]", "\RouteControl:post");
|
|
||||||
//start the app
|
|
||||||
|
|
||||||
$app->run();
|
|
||||||
|
Loading…
Reference in New Issue