43 lines
1.5 KiB
PHP
43 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Psr\Container\ContainerInterface;
|
|
use Zend\Expressive\Application;
|
|
use Zend\Expressive\MiddlewareFactory;
|
|
|
|
/**
|
|
* Setup routes with a single request method:
|
|
*
|
|
* $app->get('/', App\Handler\HomePageHandler::class, 'home');
|
|
* $app->post('/album', App\Handler\AlbumCreateHandler::class, 'album.create');
|
|
* $app->put('/album/:id', App\Handler\AlbumUpdateHandler::class, 'album.put');
|
|
* $app->patch('/album/:id', App\Handler\AlbumUpdateHandler::class, 'album.patch');
|
|
* $app->delete('/album/:id', App\Handler\AlbumDeleteHandler::class, 'album.delete');
|
|
*
|
|
* Or with multiple request methods:
|
|
*
|
|
* $app->route('/contact', App\Handler\ContactHandler::class, ['GET', 'POST', ...], 'contact');
|
|
*
|
|
* Or handling all request methods:
|
|
*
|
|
* $app->route('/contact', App\Handler\ContactHandler::class)->setName('contact');
|
|
*
|
|
* or:
|
|
*
|
|
* $app->route(
|
|
* '/contact',
|
|
* App\Handler\ContactHandler::class,
|
|
* Zend\Expressive\Router\Route::HTTP_METHOD_ANY,
|
|
* 'contact'
|
|
* );
|
|
*/
|
|
return function (Application $app, MiddlewareFactory $factory, ContainerInterface $container) : void {
|
|
$app->get('/', App\Action\HomePageAction::class, 'home');
|
|
$app->get('/api/ping', App\Action\PingAction::class, 'api.ping');
|
|
|
|
$app->get('/api/activity[/{id:\d+}]', App\Action\ActivityAction::class, 'api.activity.get');
|
|
$app->get('/api/activity/signup/{id:\d+}', App\Action\ActivitySignupAction::class, 'api.activity.signup');
|
|
$app->get('/api/activity/signoff/{id:\d+}', App\Action\ActivitySignoffAction::class, 'api.activity.signoff');
|
|
};
|