Add controller initialization logic.
This commit is contained in:
parent
4cd84dcd8a
commit
9d2deccdf9
|
@ -395,6 +395,17 @@ app.enableAuth = function(options) {
|
||||||
this.isAuthEnabled = true;
|
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) {
|
app.boot = function(options) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'`app.boot` was removed, use the new module loopback-boot instead');
|
'`app.boot` was removed, use the new module loopback-boot instead');
|
||||||
|
|
Loading…
Reference in New Issue