title: Drupal 8 restresource: No route found
body: <p>I am trying to create a rest endpoint. The way i do it is i first create a module with <code>drupal generate:module</code> then add the rest dependency and then create a restresource with <code>drupal generate:plugin:rest:resource</code>. This all works fine, the endpoint i created even shows up in the module restui with the following path: <code>/api/v1/articles</code>.
  The problem is when i go to the endpoint i created i get the following error: </p>
  
  <pre><code>{ 
    "message": "No route found for \"GET /api/v1/articles\""
  }
  </code></pre>
  
  <p>Cache rebuilding doesn't fix the problem for me and when i look in the routing table there is indeed no routing added for <code>/api/v1/articles</code>.
  Is there something i am forgetting to do?</p>
  
  <p>This is the generated rest resource:</p>
  
  <pre><code>namespace Drupal\api_articles\Plugin\rest\resource;
  
  use Drupal\Core\Session\AccountProxyInterface;
  use Drupal\rest\Plugin\ResourceBase;
  use Drupal\rest\ResourceResponse;
  use Symfony\Component\DependencyInjection\ContainerInterface;
  use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
  use Psr\Log\LoggerInterface;
  
  /**
   * Provides a resource to get view modes by entity and bundle.
   *
   * @RestResource(
   *   id = "article_rest_resource",
   *   label = @Translation("Article rest resource"),
   *   uri_paths = {
   *     "canonical" = "/api/v1/articles",
   *     "https://www.drupal.org/link-relations/create" = "/api/v1/articles"
   *   }
   * )
   */
  class ArticleRestResource extends ResourceBase {
  
    /**
     * A current user instance.
     *
     * @var \Drupal\Core\Session\AccountProxyInterface
     */
    protected $currentUser;
  
    /**
     * Constructs a Drupal\rest\Plugin\ResourceBase object.
     *
     * @param array $configuration
     *   A configuration array containing information about the plugin instance.
     * @param string $plugin_id
     *   The plugin_id for the plugin instance.
     * @param mixed $plugin_definition
     *   The plugin implementation definition.
     * @param array $serializer_formats
     *   The available serialization formats.
     * @param \Psr\Log\LoggerInterface $logger
     *   A logger instance.
     * @param \Drupal\Core\Session\AccountProxyInterface $current_user
     *   A current user instance.
     */
    public function __construct(
      array $configuration,
      $plugin_id,
      $plugin_definition,
      array $serializer_formats,
      LoggerInterface $logger,
      AccountProxyInterface $current_user) {
      parent::__construct($configuration, $plugin_id, $plugin_definition, $serializer_formats, $logger);
  
      $this-&gt;currentUser = $current_user;
    }
  
    /**
     * {@inheritdoc}
     */
    public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
      return new static(
        $configuration,
        $plugin_id,
        $plugin_definition,
        $container-&gt;getParameter('serializer.formats'),
        $container-&gt;get('logger.factory')-&gt;get('api_articles'),
        $container-&gt;get('current_user')
      );
    }
  
    /**
     * Responds to GET requests.
     *
     * Returns a list of bundles for specified entity.
     *
     * @throws \Symfony\Component\HttpKernel\Exception\HttpException
     *   Throws exception expected.
     */
    public function get() {
  
      // You must to implement the logic of your REST Resource here.
      // Use current user after pass authentication to validate access.
      if (!$this-&gt;currentUser-&gt;hasPermission('access content')) {
        throw new AccessDeniedHttpException();
      }
  
      return new ResourceResponse("Implement REST State GET!");
    }
  
  }
  </code></pre>