Skip to content

Commit

Permalink
Moving routes to separate files
Browse files Browse the repository at this point in the history
  • Loading branch information
napolux committed Aug 11, 2016
1 parent 95f8556 commit 798182f
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 21 deletions.
21 changes: 11 additions & 10 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion public/index.php
Expand Up @@ -23,7 +23,12 @@
require __DIR__ . '/../src/middleware.php';

// Register routes
require __DIR__ . '/../src/routes.php';
$routes = scandir(__DIR__ . '/../src/Routes/');
foreach ($routes as $route) {
if (strpos($route, '.php')) {
require __DIR__ . '/../src/Routes/' . $route;
}
}

// Run app
$app->run();
2 changes: 2 additions & 0 deletions src/Routes/admin.php
@@ -0,0 +1,2 @@
<?php
$app->get('/admin', 'HELLO\Controller\AdminHpController:homepage')->setName('hello.admin.hp');
2 changes: 2 additions & 0 deletions src/Routes/api.php
@@ -0,0 +1,2 @@
<?php
$app->get('/api', 'HELLO\Controller\ApiController:apiExample')->setName('hello.api.apiExample');
2 changes: 2 additions & 0 deletions src/Routes/pages.php
@@ -0,0 +1,2 @@
<?php
$app->get('/', 'HELLO\Controller\HomepageController:hp')->setName('hello.website.hp');
10 changes: 0 additions & 10 deletions src/routes.php

This file was deleted.

0 comments on commit 798182f

Please sign in to comment.