I am migrating to v5, but it seems like my custom routes to extend user-permissions don’t work. I see them in Settings > Roles but when I click the gear Icon to see the path next to one of my routes, it doesn’t show anything and I get 404 when querying those new routes.
If someone can give me a simple working example of their strapi-server.ts I would be very grateful.
Otherwise, here is whati have (stripped down version). If anyone can point out why it isn’t working. FYI I did install the documentation plugin and the routes also don’t appear in the swagger page
module.exports = (plugin) => {
plugin.controllers.user.getMe = async (ctx) => {
const user = ctx.state.user;
if (!user) {
return ctx.unauthorized();
}
try {
//Doing so manipulation
return ctx.send(user);
} catch (error) {
return ctx.internalServerError({ message: "Failed to retrieve user", details: error });
}
};
plugin.routes['content-api'].routes.push(
{
method: "GET",
path: "/users/test/me",
handler: "user.getMe"
}
)
return plugin
}
I tried renaming the path to a bunch of things, to either overwrite the basic /api/users/me or to create a new different route and it doesn’t change anything. I do see getMe in my role permissions in the UI but that’s it, no route
This topic has been created from a Discord post (1288937679844802631) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord