25 lines
652 B
PHP
25 lines
652 B
PHP
|
<?php
|
||
|
|
||
|
$f3 = require('lib/base.php');
|
||
|
|
||
|
// Définition des variable de base pour F3
|
||
|
$f3->set('AUTOLOAD', 'lib/;controllers/;models/');
|
||
|
$f3->set('DEBUG', 3);
|
||
|
$f3->set('UI', 'views/');
|
||
|
|
||
|
// Gestion des erreurs, l'api = retour JSON, autres = retour HTML
|
||
|
$f3->set('ONERROR', function (Base $f3) {
|
||
|
if (strpos($f3->get('PATH'), '/api')) {
|
||
|
echo $f3->get('ERROR.text');
|
||
|
} else {
|
||
|
echo Template::instance()->render('error.htm');
|
||
|
}
|
||
|
});
|
||
|
|
||
|
// Routes
|
||
|
$f3->route('GET /api/member/@identifiant', 'MemberController->member');
|
||
|
$f3->route('GET /api/member', 'MemberController->member');
|
||
|
$f3->route('GET /', 'TestController->index');
|
||
|
|
||
|
$f3->run();
|