Create custom endpoint for Users in strapi v4

Hey andrew,

To extend a plugin’s interface using the ./src/extensions folder in v4 of strapi:

  1. Create the ./src/extensions folder at the root of the app, if the folder does not already exist.
  2. Create a subfolder with the same name as the plugin to be extended, in your case users-permissions.
  3. Depending on what needs to be extended:
  • create a strapi-server.js file to extend a plugin’s back end using the Server API
  • or create a strapi-admin.js file to extend the admin panel.

Since you are looking for controllers and routes, here is an example of a backend extension:

// path: ./src/extensions/users-permissions/strapi-server.js

module.exports = (plugin) => {
  plugin.controllers.user.find = (ctx) => {
console.log('test');
};

  return plugin;
};

This guide is from: Plugins extension - Strapi Developer Docs

4 Likes