Edit Page

sails.reloadActions()

This feature is still experimental.
#

This method is still under development, and its interface and/or behavior could change at any time.

Flush and reload all Sails actions

sails.reloadActions(cb);

Or:

This method causes hooks to run their registerActions() methods if they have them. After the hooks are finished reloading / re-registering their actions, actions in the api/controllers folder (including those stored in controller files) are reloaded and merged on top of those loaded via hooks.

This method is useful primarily in development scenarios.

Usage

#
  Argument Type Details
1 options Dictionary? Currently accepts one key, hooksToSkip, which if given should be an array of names of hooks that should not call their reloadActions method.
2 callback Function A callback to be called with the virtual response.

Notes

#
  • Never dynamically replace your Sails.js controller or action files on disk with untrusted code at runtime, regardless of whether you are using .reloadActions() in your app or not. Since reloadActions() runs the code in your Sails.js app's files, if the files are not safe to run, then using reloadActions() would be a security risk. This risk is only present if your Sails app is deliberately overwriting its own files to replace them with unsafe code.

Is something missing?

If you notice something we've missed or could be improved on, please follow this link and submit a pull request to the sails repo. Once we merge it, the changes will be reflected on the website the next time it is deployed.

Reference

Reference