I am trying to add a method available for all controllers in sailsjs, much like the blueprint methods are. The method should also be exposed to a REST route (like /modelName/myBlueprintMethod).
How can I go about and do this?
I have seen lots of Qs for how to override the blueprint methods but what i need is extend the blueprint.
A little context.
What I want to achieve is to expose the schema of the model related to the controller to automate some front-end CMS.
Thanks
I also wanted a similar solution, although it would be a subset of your question: Asked a question here.
One way to go about this (and there could be others) is:
Make a service, send it the parameters and use it in all controllers. Hope this helps.
I did mine as described here: OVERRIDE CRUD BLUEPRINTS.
I created the blueprint hooks in /api/blueprints/
...