2016-04-10 10:38:07 +03:00
|
|
|
<?php
|
2019-10-05 18:26:10 +03:00
|
|
|
|
2017-10-12 11:13:20 +03:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2018-09-20 21:27:34 +03:00
|
|
|
namespace Shlinkio\Shlink;
|
|
|
|
|
2017-04-13 10:43:11 +03:00
|
|
|
use Zend\Expressive;
|
2017-03-24 23:10:25 +03:00
|
|
|
use Zend\Stratigility\Middleware\ErrorHandler;
|
2016-04-10 10:38:07 +03:00
|
|
|
|
|
|
|
return [
|
2016-04-17 20:34:16 +03:00
|
|
|
|
2016-04-10 10:38:07 +03:00
|
|
|
'middleware_pipeline' => [
|
2019-11-22 20:01:38 +03:00
|
|
|
'error-handler' => [
|
2018-12-07 21:46:46 +03:00
|
|
|
'middleware' => [
|
|
|
|
ErrorHandler::class,
|
2019-11-22 20:01:38 +03:00
|
|
|
],
|
|
|
|
'priority' => 15,
|
|
|
|
],
|
|
|
|
// 'error-handler-rest' => [
|
|
|
|
// 'path' => '/rest',
|
|
|
|
// 'middleware' => [],
|
|
|
|
// 'priority' => 14,
|
|
|
|
// ],
|
|
|
|
|
|
|
|
'pre-routing' => [
|
|
|
|
'middleware' => [
|
2018-12-07 21:46:46 +03:00
|
|
|
Expressive\Helper\ContentLengthMiddleware::class,
|
|
|
|
Common\Middleware\CloseDbConnectionMiddleware::class,
|
|
|
|
],
|
2018-09-20 21:27:34 +03:00
|
|
|
'priority' => 12,
|
2017-03-24 23:10:25 +03:00
|
|
|
],
|
|
|
|
'pre-routing-rest' => [
|
2018-04-07 09:31:03 +03:00
|
|
|
'path' => '/rest',
|
2017-03-24 23:10:25 +03:00
|
|
|
'middleware' => [
|
2018-09-20 21:27:34 +03:00
|
|
|
Rest\Middleware\PathVersionMiddleware::class,
|
|
|
|
Rest\Middleware\ShortUrl\ShortCodePathMiddleware::class,
|
2017-03-24 23:10:25 +03:00
|
|
|
],
|
|
|
|
'priority' => 11,
|
|
|
|
],
|
|
|
|
|
2016-04-10 10:38:07 +03:00
|
|
|
'routing' => [
|
|
|
|
'middleware' => [
|
2018-03-21 03:05:55 +03:00
|
|
|
Expressive\Router\Middleware\RouteMiddleware::class,
|
2016-07-03 09:40:39 +03:00
|
|
|
],
|
|
|
|
'priority' => 10,
|
|
|
|
],
|
|
|
|
|
2017-03-24 23:10:25 +03:00
|
|
|
'rest' => [
|
|
|
|
'path' => '/rest',
|
|
|
|
'middleware' => [
|
2018-09-20 21:27:34 +03:00
|
|
|
Rest\Middleware\CrossDomainMiddleware::class,
|
2018-03-21 02:46:26 +03:00
|
|
|
Expressive\Router\Middleware\ImplicitOptionsMiddleware::class,
|
2018-09-20 21:27:34 +03:00
|
|
|
Rest\Middleware\BodyParserMiddleware::class,
|
2018-09-24 20:24:23 +03:00
|
|
|
Rest\Middleware\AuthenticationMiddleware::class,
|
2017-03-24 23:10:25 +03:00
|
|
|
],
|
|
|
|
'priority' => 5,
|
|
|
|
],
|
|
|
|
|
2016-07-03 09:40:39 +03:00
|
|
|
'post-routing' => [
|
|
|
|
'middleware' => [
|
2018-03-21 03:05:55 +03:00
|
|
|
Expressive\Router\Middleware\DispatchMiddleware::class,
|
2018-09-20 21:27:34 +03:00
|
|
|
Core\Response\NotFoundHandler::class,
|
2016-04-10 10:38:07 +03:00
|
|
|
],
|
|
|
|
'priority' => 1,
|
|
|
|
],
|
|
|
|
],
|
|
|
|
];
|