Plugin server routes are not rightly registeres

System Information
  • Strapi Version: 4.25.3
  • Operating System: Manjaro Linux
  • Database: SQLite
  • Node Version: 20.15.1
  • NPM Version: 10.7.0
  • PNPM Version: 9.7.1

We are working on adding configuration support for Strapi Plugin Rich Text, you can see the setup there.

We set the routes as follows:
Quick update, this was it! Thanks for pointing out the right direction. <@692165805236027402> maybe you need to define your routes like this:
routes/index.ts:


export default { admin };

routes/admin.ts

export default {
  type: "admin",
  routes: [
    {
      method: "GET",
      path: "/settings",
      handler: "settings.getSettings",
      config: {
        policies: ["admin::isAuthenticatedAdmin"],
      },
    },
    {
      method: "PUT",
      path: "/settings",
      handler: "settings.updateSettings",
      config: {
        policies: ["admin::isAuthenticatedAdmin"],
      },
    },
  ],
};

Calling the routes from the API we always get 404, i.e., the route does not exist:

We decided to check it on Strapi and we get the same, those routes does not exist:

pnpm strapi routes:list                   ✔ 

> strapi@0.1.0 strapi /media/Storage/Projects/Experiments/opensource/strapi-plugin-rich-text/apps/strapi
> strapi "routes:list"

├────────────────────┼─────────────────────────────────────────────────────────────────────────────────┤
│ HEAD|GET           │ /strapi-plugin-rich-text                                                        │
├────────────────────┼─────────────────────────────────────────────────────────────────────────────────┤
│ HEAD|GET           │ /i18n/iso-locales                                                               │
├────────────────────┼─────────────────────────────────────────────────────────────────────────────────┤
│ HEAD|GET           │ /i18n/locales                                                                   │
├────────────────────┼─────────────────────────────────────────────────────────────────────────────────┤
│ POST               │ /i18n/locales                                                                   │
├────────────────────┼─────────────────────────────────────────────────────────────────────────────────┤
│ PUT                │ /i18n/locales/:id                                                               │
├────────────────────┼─────────────────────────────────────────────────────────────────────────────────┤
│ DELETE             │ /i18n/locales/:id                                                               │
├────────────────────┼─────────────────────────────────────────────────────────────────────────────────┤
│ POST               │ /i18n/content-manager/actions/get-non-localized-fields                          │
└────────────────────┴─────────────────────────────────────────────────────────────────────────────────┘

We just followed the structure of Strapi plugins, like internationalization, but IT DOES NOT WORK.

WHY?