From f248d44e68c106576aef18985f98067c5fb7cffc Mon Sep 17 00:00:00 2001
From: Alejandro Celaya <alejandro@alejandrocelaya.com>
Date: Sun, 10 Apr 2016 12:06:28 +0200
Subject: [PATCH] Improved config

---
 composer.json                      | 3 ++-
 config/app.php                     | 2 ++
 config/autoload/routes.global.php  | 9 +++++++++
 public/index.php                   | 4 +---
 templates/layout/default.html.twig | 4 +---
 5 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/composer.json b/composer.json
index a909e884..a69b5905 100644
--- a/composer.json
+++ b/composer.json
@@ -24,7 +24,8 @@
         "phpunit/phpunit": "^4.8",
         "squizlabs/php_codesniffer": "^2.3",
         "roave/security-advisories": "dev-master",
-        "filp/whoops": "^2.0"
+        "filp/whoops": "^2.0",
+        "symfony/var-dumper": "^3.0"
     },
     "autoload": {
         "psr-4": {
diff --git a/config/app.php b/config/app.php
index 4d847f64..08b73799 100644
--- a/config/app.php
+++ b/config/app.php
@@ -2,6 +2,8 @@
 use Zend\Expressive\Application;
 use Zend\ServiceManager\ServiceManager;
 
+chdir(dirname(__DIR__));
+
 require __DIR__ . '/../vendor/autoload.php';
 
 // Build container
diff --git a/config/autoload/routes.global.php b/config/autoload/routes.global.php
index 83650c5c..773f3e87 100644
--- a/config/autoload/routes.global.php
+++ b/config/autoload/routes.global.php
@@ -12,6 +12,15 @@ return [
             },
             'allowed_methods' => ['GET'],
         ],
+        [
+            'name' => 'cli',
+            'path' => 'command-name',
+            'middleware' => function ($req, $resp) {
+                $resp->getBody()->write('Hello world from cli');
+                return $resp;
+            },
+            'allowed_methods' => ['GET'],
+        ],
     ],
     
 ];
diff --git a/public/index.php b/public/index.php
index cf46cc99..16af56e5 100644
--- a/public/index.php
+++ b/public/index.php
@@ -1,8 +1,6 @@
 <?php
 use Zend\Expressive\Application;
 
-chdir(dirname(__DIR__));
-
 /** @var Application $app */
-$app = include 'config/app.php';
+$app = include __DIR__ . '/../config/app.php';
 $app->run();
diff --git a/templates/layout/default.html.twig b/templates/layout/default.html.twig
index 163e6437..b3664d0e 100644
--- a/templates/layout/default.html.twig
+++ b/templates/layout/default.html.twig
@@ -43,9 +43,7 @@
                             </a>
                         </li>
                         <li>
-                            <a href="{{ path('api.ping') }}">
-                                Ping Test
-                            </a>
+
                         </li>
                     </ul>
                 </div>