forked from projects/fipamo
35 lines
837 B
PHP
35 lines
837 B
PHP
<?php
|
|
|
|
namespace brain\init;
|
|
|
|
use brain\utility\HandleCors;
|
|
use Slim\Factory\AppFactory;
|
|
use Slim\Views\Twig;
|
|
// Fipamo Core Classes
|
|
use Slim\Views\TwigMiddleware;
|
|
|
|
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();
|
|
}
|
|
}
|