I have a Sails API where a certain model (Role) needs to return data different to the default. I have written a method in the controller to send back the data I want, but if I set up a route in config/routes.js
like so:
'GET /role/:id': 'RoleController.readRole'
It takes precedence over other routes set up like
http://localhost:1337/role/count/
or http://localhost:1337/role?limit=10&populate=user&sort=createdAt+DESC
How can I overwrite the findOne method only for the Role model and leave everything else the same? As far as I can see Sails only lets me overwrite a blueprint for all models.