Created
September 19, 2014 20:25
-
-
Save sgress454/e1413aa86d08ba2e9e24 to your computer and use it in GitHub Desktop.
Reload a Sails API at runtime
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Reload controller middleware | |
sails.hooks.controllers.loadAndRegisterControllers(function() { | |
sails.once('hook:orm:reloaded', function() { | |
// Flush router | |
sails.router.flush(); | |
// Reload blueprints | |
sails.hooks.blueprints.bindShadowRoutes(); | |
return cb && cb(); | |
}); | |
// Reload ORM | |
sails.emit('hook:orm:reload'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment