How to customize Strapi backend (content-manager) controllers, services and validation?

So for v4, to update the controllers that are called when you CRUD in the Content Manager, you can now follow the flow described here:

  1. Create a file called ./src/extensions/content-manager/strapi-server.js. With following boiler plate:
module.exports = (plugin) => {
  let original = plugin.controllers.["collection-types"].find;
  plugin.controllers.["collection-types"].find = (ctx) => {
     // Do your thing
     // Call original function
     original(ctx)
  };

  return plugin;
};
  1. To find what exists, you can check node_modules/@strapi/plugin-content-manager/server/controllers; each file there corresponds to the key in plugin.controllers, and each function inside of the exports can be overwritten. (in the example I used collection-types and find respectively).
5 Likes