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:
sails.reloadActions(options, cb)
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.
Argument | Type | Details | |
---|---|---|---|
1 | options | 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 | A callback to be called with the virtual response. |
- 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. SincereloadActions()
runs the code in your Sails.js app's files, if the files are not safe to run, then usingreloadActions()
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.