-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
36 lines (27 loc) · 1.12 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
error_reporting(E_ERROR);
ini_set('display_errors', 1);
define('DS', DIRECTORY_SEPARATOR);
define('BASE_PATH', __DIR__);
define('MUDI_PATH', BASE_PATH . DS . 'src/Mudi');
define('RESOURCES_PATH', MUDI_PATH . DS . 'Resources');
define('VIEW_PATH', RESOURCES_PATH . DS .'views');
define('TEST_PATH', BASE_PATH . DS . 'tests');
define('OUTPUT_DIR', BASE_PATH . DS . 'output');
use Silex\Application;
require_once __DIR__ . '/vendor/autoload.php';
$app = new Application;
$app['debug'] = true;
//twig as service
$app->register(new Silex\Provider\TwigServiceProvider(), array(
'twig.path' => array(VIEW_PATH , VIEW_PATH . '/public'),
'twig.options' => array('autoescape' => false)
));
//routes
$app->get('/', 'Mudi\\Controller\\IndexController::index');
$app->post('/check-resource', 'Mudi\\Controller\\IndexController::checkResource');
$app->get('/show-results', 'Mudi\\Controller\\IndexController::showResults');
//scoring
$app->register(new Igorw\Silex\ConfigServiceProvider(BASE_PATH . "/config/mudi.json"));
$app['dispatcher']->addSubscriber( new \Mudi\ScoringSubscriber($app['scoring']) );
$app->run();