balderdashy/sails — pull request #1039 by ragulka (2013-10-26 13:52:19+00:00)
Title: Allow setting hook priority

Note: I am re-opening this PR now that it is based against dev branch.

This PR allows setting a priority number for a hook. Hooks with higher priority will be loaded before others. Higher priority = lower number. Lower priority = higher number.

The default priority is 10. This should allow enough flexibility to load user-defined hooks before built-in hooks.

An example use-case is where a user wants run some middleware before the built-in CORS or CSRF middleware, potentially to do some kind of pre-filtering or whitelisting, etc.