<?php

error_reporting(E_ALL);

try
{
    $path = dirname(dirname(__FILE__));
    define('BASE_PATH',$path);
    define('MODEL_DIR', $path.'/app/models');

    /**
     * Read the configuration
     */
    $config = include BASE_PATH . "/app/config/config.php";

    /**
     * Read auto-loader
     */
    include BASE_PATH . "/app/config/loader.php";

    /**
     * Read services
     */
    include BASE_PATH . "/app/config/services.php";

    /**
     * Handle the request
     */
    $application = new \Phalcon\Mvc\Application();
    $application->setDI($di);
    $response = $application->handle();

    $response->send();
}
catch (Phalcon\Exception $e)
{
    echo $e->getMessage();
}
catch (PDOException $e)
{
    echo $e->getMessage();
}