* initial api stuff

This commit is contained in:
Danyi Dávid
2018-05-11 10:46:00 +02:00
parent 77325b8e94
commit be7bc7279d
48 changed files with 3793 additions and 325 deletions

View File

@@ -21,6 +21,7 @@ return [
// Use 'factories' for services provided by callbacks/factory classes.
'factories' => [
// Fully\Qualified\ClassName::class => Fully\Qualified\FactoryName::class,
Tuupola\Middleware\CorsMiddleware::class => DoctrineExpressiveModule\Middleware\CorsMiddlewareFactory::class,
],
],
];

View File

@@ -13,6 +13,7 @@ $cacheConfig = [
];
$aggregator = new ConfigAggregator([
\Zend\Hydrator\ConfigProvider::class,
\Zend\Log\ConfigProvider::class,
\Zend\Expressive\Router\FastRouteRouter\ConfigProvider::class,
\Zend\HttpHandlerRunner\ConfigProvider::class,
@@ -25,6 +26,7 @@ $aggregator = new ConfigAggregator([
\Zend\Expressive\Router\ConfigProvider::class,
// Default App module config
DoctrineExpressiveModule\ConfigProvider::class,
App\ConfigProvider::class,
// Load application config in a pre-defined order in such a way that local settings

View File

@@ -3,6 +3,7 @@
declare(strict_types=1);
use Psr\Container\ContainerInterface;
use Tuupola\Middleware\CorsMiddleware;
use Zend\Expressive\Application;
use Zend\Expressive\Handler\NotFoundHandler;
use Zend\Expressive\Helper\ServerUrlMiddleware;
@@ -53,7 +54,8 @@ return function (Application $app, MiddlewareFactory $factory, ContainerInterfac
// Order here matters; the MethodNotAllowedMiddleware should be placed
// after the Implicit*Middleware.
$app->pipe(ImplicitHeadMiddleware::class);
$app->pipe(ImplicitOptionsMiddleware::class);
// $app->pipe(ImplicitOptionsMiddleware::class);
$app->pipe(CorsMiddleware::class);
$app->pipe(MethodNotAllowedMiddleware::class);
// Seed the UrlHelper with the routing results:

View File

@@ -36,6 +36,20 @@ return function (Application $app, MiddlewareFactory $factory, ContainerInterfac
$app->get('/', App\Handler\HomePageHandler::class, 'home');
$app->get('/api/ping', App\Handler\PingHandler::class, 'api.ping');
$app->get('/api/years', App\Handler\Api\YearsHandler::class, 'api.years');
$app->route(
'/api/judge[/{id:\d+}]',
App\Handler\Api\JudgesHandler::class,
['GET','POST','PUT','DELETE'],
'api.judges'
);
$app->route(
'/api/awardee[/{id:\d+}]',
App\Handler\Api\AwardeeHandler::class,
['GET','POST','PUT','DELETE'],
'api.awardees'
);
$app->get('/the-prize', App\Handler\PrizeRedirectHandler::class, 'the-prize');
$app->get(
'/the-prize/{article:background-and-purpose|description-and-values|aspects-for-selection|gran-prize-award-events}',