I'm trying to create a custom route and handler for user-permissions but it's not working. Not sure though if my method is wrong or cannot be done. By the way here is my code.
/config/routes.json
{
"routes": [
{
"method": "PUT",
"path": "/users/:id/approve",
"handler": "users.approve",
"config": {
"policies": []
}
}
]
}
/controllers/Users.js
module.exports = {
approve: async ctx => {
const { id } = ctx.params;
console.log('approve user')
}
};
From routes, the handler should read the approve
in controller but the strapi threw error TypeError: Cannot read property 'approve' of undefined
question from:
https://stackoverflow.com/questions/66061988/custom-handler-in-strapi 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…