From 9d2deccdf99ccb14356c27606139fbaeefb23cee Mon Sep 17 00:00:00 2001 From: Richard Pringle Date: Wed, 20 Apr 2016 17:26:54 -0400 Subject: [PATCH] Add controller initialization logic. --- lib/application.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/application.js b/lib/application.js index 44e35b1d..8d0254cd 100644 --- a/lib/application.js +++ b/lib/application.js @@ -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');