Hi! I’m working within a Strapi plugin and need to implement sorting logic based on custom fields (which I compute based on other fields). To achieve this, I want to extend the Strapi controller that handles requests to the following path:
http://localhost:1337/content-manager/collection-types/api::some_path:some_path
.
The Problem:
When making requests to content-manager
, I cannot intercept them in regular controllers at the top level, as these controllers are only intended for external requests (like via the API). I need to modify the sorting logic that is executed within the request to content-manager
, but I can’t figure out how to do this.
I’ve tried using middleware, but it works only in the direction from the client to the server, which doesn’t help in this case since I need to modify the logic at the controller level, not just intercept the request.
The Question:
How can I override or extend the request handling logic for requests to content-manager
in Strapi? Can I create a custom controller or intercept these requests elsewhere to modify their response (e.g., add custom sorting)?
In summary:
- The client sends a request to
content-manager
. - The request is processed by the controller (I want to change the sorting logic within this request).
- The response is sent back to the client.
If this were an external request, I could simply go to api/some_entity/controllers/index.ts
and extend the find method. But the issue here is that the request is going to the content-manager.
I would appreciate any help or advice!