/**
* {@inheritdoc}
*/
public function routes() { $routes =
new RouteCollection();
$upload_routes =
new RouteCollection();
// JSON:API's routes: entry point + routes for every resource type.
foreach ($this->resourceTypeRepository->
all() as $resource_type) { $routes->
addCollection(static::
getRoutesForResourceType($resource_type,
$this->jsonApiBasePath
));
$upload_routes->
addCollection(static::
getFileUploadRoutesForResourceType($resource_type,
$this->jsonApiBasePath
));
} $routes->
add('jsonapi.resource_list',
static::
getEntryPointRoute($this->jsonApiBasePath
));
// Require the JSON:API media type header on every route, except on file
// upload routes, where we require `application/octet-stream`.
$routes->
addRequirements(['_content_type_format' => 'api_json'
]);
$upload_routes->
addRequirements(['_content_type_format' => 'bin'
]);
$routes->
addCollection($upload_routes);