Configuracion Minima

This commit is contained in:
2026-01-03 00:11:55 -07:00
parent 727be27d47
commit da8bd27d5f
8 changed files with 326 additions and 0 deletions

30
app/config/routes.php Normal file
View File

@@ -0,0 +1,30 @@
<?php
use app\controllers\ApiExampleController;
use app\middlewares\SecurityHeadersMiddleware;
use flight\Engine;
use flight\net\Router;
/**
* @var Router $router
* @var Engine $app
*/
// This wraps all routes in the group with the SecurityHeadersMiddleware
$router->group('', function(Router $router) use ($app) {
$router->get('/', function() use ($app) {
$app->render('welcome', [ 'message' => 'You are gonna do great things!' ]);
});
$router->get('/hello-world/@name', function($name) {
echo '<h1>Hello world! Oh hey '.$name.'!</h1>';
});
$router->group('/api', function() use ($router) {
$router->get('/users', [ ApiExampleController::class, 'getUsers' ]);
$router->get('/users/@id:[0-9]', [ ApiExampleController::class, 'getUser' ]);
$router->post('/users/@id:[0-9]', [ ApiExampleController::class, 'updateUser' ]);
});
}, [ SecurityHeadersMiddleware::class ]);