You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
943 B
PHP
37 lines
943 B
PHP
<?php
|
|
|
|
namespace brain\init;
|
|
|
|
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;
|
|
// Fipamo Core Classes
|
|
use brain\utility\HandleCors;
|
|
|
|
class App
|
|
{
|
|
public function __construct()
|
|
{
|
|
// when a new class is made, run composer dump-autoload
|
|
// set up cors
|
|
new HandleCors();
|
|
$app = AppFactory::create();
|
|
$twig = Twig::create("../brain/views/");
|
|
$app->add(TwigMiddleware::create($app, $twig));
|
|
//set up routing
|
|
$app->get(
|
|
"/[{first}[/{second}[/{third}[/{fourth}[/{fifth}]]]]]",
|
|
"brain\controller\RouteControl:get"
|
|
);
|
|
$app->post(
|
|
"/[{first}[/{second}[/{third}[/{fourth}]]]]",
|
|
"brain\controller\RouteControl:post"
|
|
);
|
|
//start the app
|
|
|
|
$app->run();
|
|
}
|
|
}
|