Automatically include custom Package's routes in Neos

Hi,

I am having an issue with the automated inclusion of routes of my plugin (Sarkosh.CdCollection) in Neos. While looking at Neos.Setup as an example I figured that the package’s Routes.yaml file has not been included in any global Settings.yaml or Routes.yaml file.

I don’t see my routes even here:

./flow routeing:list

My Question is do I need to specifically include my package’s routes? If yes then why is it not the case for Neos.Setup?

Packages/Sarkosh.CdCollection/Configuration/Routes.yaml

  name: 'Sarkosh'
  uriPattern: 'sarkosh/index'
  defaults:
    '@package':    'Sarkosh.CdCollection'
    '@controller': 'Standard'
    '@action':     'index'
    '@format': 'html'
  

When I access the route via http://neos.local/sarkosh/index it returns this error

Page Not Found
Sorry, the page you requested was not found.
#1303209195: No controller could be resolved which would match your request. Package key: "", controller name: "Standard". (GET http://neos.local/sarkosh/index)

I apologize if my question sounds dumb or very basic.

You can include your own packages Routes.yaml via your packages Settings.yaml (which is autoloaded, after installation)

http://flowframework.readthedocs.io/en/stable/TheDefinitiveGuide/PartIII/Routing.html#subroutes-from-settings

Neos:
  Flow:
    mvc:
      routes:
        'Some.Package': TRUE

1 Like

Hi Soren,
Thanks for your reply, just wondering how is it working for Neos.Setup or other Packages?

I responded to your ticket where you ask that question, please see that for further information :slight_smile:

Hi @aftabnaveed,

First of all:

Never apologize, this forum is here for all our dumb, basic, complex and philosophical questions. Well almost all :wink:

As others mentioned, Routes are not active just by installing a package.
You can include your custom routes as so called “sub routes” from the main Routes.yaml or, more flexible and available since Flow v3.1) activate them via Settings.yaml:

http://flowframework.readthedocs.io/en/stable/TheDefinitiveGuide/PartIII/Routing.html#subroutes-from-settings

The setup package does things a bit differently for technical reasons (most importantly: The router might not be configured correctly and that shouldn’t prevent you from accessing the setup):

It configures a so called HTTP Component (see setup/Configuration/Settings.yaml at main · neos/setup · GitHub) to inject the custom routing early into the request handling - nothing you would need for a custom package usually.