mirror of
https://github.com/moparisthebest/wallabag
synced 2024-12-18 05:32:23 -05:00
Split controllers into different files
This commit is contained in:
parent
e71f24ec63
commit
3734cb0090
6
app/controllers/api.php
Normal file
6
app/controllers/api.php
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$api = $app['controllers_factory'];
|
||||||
|
$api->get('/', function () { return 'API home page'; });
|
||||||
|
|
||||||
|
return $api;
|
@ -1,9 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
use Poche\Model\Entry;
|
|
||||||
|
|
||||||
$app->get('/', function () use ($app) {
|
//Default Website
|
||||||
|
$app->mount('/', include 'front.php');
|
||||||
|
|
||||||
$entry = new Entry(1, "Titre de test");
|
//Rest API
|
||||||
|
$app->mount('/api', include 'api.php');
|
||||||
return $app['twig']->render('index.twig', array('entry' => $entry));
|
|
||||||
});
|
|
||||||
|
13
app/controllers/front.php
Normal file
13
app/controllers/front.php
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
use Poche\Model\Entry;
|
||||||
|
|
||||||
|
$front = $app['controllers_factory'];
|
||||||
|
$front->get('/', function () use ($app) {
|
||||||
|
|
||||||
|
$entry = new Entry(1, "Titre de test");
|
||||||
|
|
||||||
|
return $app['twig']->render('index.twig', array('entry' => $entry));
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
return $front;
|
Loading…
Reference in New Issue
Block a user