Add controller initialization logic.

This commit is contained in:
Richard Pringle 2016-04-20 17:26:54 -04:00
parent 4cd84dcd8a
commit 9d2deccdf9
1 changed files with 11 additions and 0 deletions

View File

@ -395,6 +395,17 @@ app.enableAuth = function(options) {
this.isAuthEnabled = true;
};
app.controller = function(controllerCtor, options) {
var self = this;
SharedClass = RemoteObjects.SharedClass;
controllerCtor._sharedClass = new SharedClass(controllerCtor.name);
controllerCtor._sharedClass.resolve = function() {
return new controllerCtor(app, remotingContext);
};
app.remotes().addClass(controllerCtor._sharedClass);
};
app.boot = function(options) {
throw new Error(
'`app.boot` was removed, use the new module loopback-boot instead');