Control Flow of Strapi Admin Panel

System Information
  • **Strapi Version **: v3.6.2
  • **Operating System **: Windows 10
  • **Database **: sqllite
  • **Node Version **: v16.1.0
  • **NPM Version – **: v7.11.2

I am using the community edition of strapi, as by installing the npx create-strapi-app my-project --quickstart In this, i signup with admin account on localhost, but when we create Collection Types and add some data in that collection, like having Categories as Collection and we enter the name of the Category as Dinner or something else. I want to know the flow of the api where its stores in which folder it exists. I checked in the api folder there is only routes defined and nothing in the services and controllers. I checked for the documentation, but nothing find in that.

Like in a Scenario, I want if the collection created or updated by admin panel, it will be printed in the console. Basically I want to override the controller of admin panel.

There are two locations, the REST/GraphQL controllers come from our core-api: strapi/packages/strapi/lib/core-api at master · strapi/strapi · GitHub

These are easily customized and we have code samples for these in our documentation here:

Controllers: Backend customization - Strapi Developer Documentation
Services: Backend customization - Strapi Developer Documentation

The Admin panel is a bit more complex and it’s separated from the end-user ones, the generalized controllers and services are in the content-manager plugin:

Controllers: strapi/packages/strapi-plugin-content-manager/controllers at master · strapi/strapi · GitHub
Services: strapi/packages/strapi-plugin-content-manager/services at master · strapi/strapi · GitHub

And to modify these you need to use our extensions system: Troubleshooting - Strapi Developer Documentation

1 Like

Thank you for Helping.

I just override the controller function of strapi-plugin-content-manager in nodeModules by adding the content-manager/controllers/collection-types.js in extension folder.

In which i override the update function but i want to override the controller function for certain routes or collection types. Unless the default function will work.
Can you tell me how to do that?

I assume, though I’ve never tried, you just need to check the incoming model and execute logic if that model matches some list of allowed models else it falls back to the default.

I’d suggest starting by throwing some console.log()s in and see what comes in.

Like if you were trying to modify the logic of:

The model comes from ctx.params (given this will be the internal model name which should be something like application::model.model)

1 Like

I tried this approach when it comes to populate the document in the collection it is giving me the error MissingErrorSchema. So i attached the schema of the collection from api/orders/models/orders.settings.json to get rid of this error. When i am using with node and mongoDB, it is working perfectly fine. Can you please, help me in this?