- Strapi Version: 4
- Operating System: MacOS
- Database: sqlite / Postgress
- Node Version: v16.13.1
- NPM Version:
- Yarn Version: 3.1.1
Hi, In Strapi 3 all routes were handled in the routes.json. When a new content type was added, all core routes were added to this routes.json automatically. When there was a need for an additional route, I could duplicate on of the existing routes and modify it.
Now with Strapi 4 the routes are not added to a routes file anymore, instead only a
createCoreRouter() function is called which dynamically creates all core routes.
For modifying the routes, the Strapi 4 Documentation lists two ways:
First, modifying the core routes by adding a second paramater to this
Second, using a custom router and adding all routes manually.
However, I would like to use a combination of both. I want to use all core routes but additionally some custom ones e.g. “deleteAllExpired”.
Is there a way to create a custom additional route, without rebuilting the core routes manually? e.g. extending the
createCoreRouter() function with some custom routes? I did not find an example on how to do this.
Thank you for your help.