-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmvc.php
39 lines (29 loc) · 1.1 KB
/
mvc.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
36
37
38
39
<?php
/*
* This file is part of the PHALCON-EXT package.
*
* (c) Jitendra Adhikari <[email protected]>
* <https://github.com/adhocore>
*
* Licensed under MIT license.
*/
use Phalcon\Mvc\Application;
use Phalcon\Mvc\Router;
use PhalconExt\Http\Middleware\Cache;
use PhalconExt\Http\Middleware\Cors;
use PhalconExt\Http\Middleware\Throttle;
use PhalconExt\Http\Middlewares;
// MVC app
$di = require __DIR__ . '/bootstrap.php';
$di->get('router')->setUriSource(Router::URI_SOURCE_GET_URL);
$app = new Application($di);
require_once __DIR__ . '/IndexController.php';
$di->get('router')->add('/', ['controller' => 'index', 'action' => 'index'])->setName('home');
$di->get('router')->add('/mail', ['controller' => 'index', 'action' => 'mail']);
$di->get('router')->add('/cors', ['controller' => 'index', 'action' => 'cors']);
$di->get('router')->add('/corsheader', ['controller' => 'index', 'action' => 'corsheader'], ['GET', 'OPTIONS']);
// For test return the app instance
if (getenv('APP_ENV') === 'test') {
return $app;
}
(new Middlewares([Throttle::class, Cors::class, Cache::class]))->wrap($app);