MCPcopy
hub / github.com/loopbackio/loopback-next / constructor

Method constructor

packages/core/src/application.ts:118–144  ·  view source on GitHub ↗
(configOrParent?: ApplicationConfig | Context, parent?: Context)

Source from the content-addressed store, hash-verified

116 constructor(config?: ApplicationConfig, parent?: Context);
117
118 constructor(configOrParent?: ApplicationConfig | Context, parent?: Context) {
119 // super() has to be first statement for a constructor
120 super(...buildConstructorArgs(configOrParent, parent));
121 this.scope = BindingScope.APPLICATION;
122
123 this.options =
124 configOrParent instanceof Context ? {} : (configOrParent ?? {});
125
126 // Configure debug
127 this._debug = debug;
128
129 // Bind the life cycle observer registry
130 this.bind(CoreBindings.LIFE_CYCLE_OBSERVER_REGISTRY)
131 .toClass(LifeCycleObserverRegistry)
132 .inScope(BindingScope.SINGLETON);
133 // Bind to self to allow injection of application context in other modules.
134 this.bind(CoreBindings.APPLICATION_INSTANCE).to(this);
135 // Make options available to other modules as well.
136 this.bind(CoreBindings.APPLICATION_CONFIG).to(this.options);
137
138 // Also configure the application instance to allow `@config`
139 this.configure(CoreBindings.APPLICATION_INSTANCE).toAlias(
140 CoreBindings.APPLICATION_CONFIG,
141 );
142
143 this._shutdownOptions = {signals: ['SIGTERM'], ...this.options.shutdown};
144 }
145
146 /**
147 * Register a controller class with this application.

Callers

nothing calls this directly

Calls 7

buildConstructorArgsFunction · 0.85
inScopeMethod · 0.80
toClassMethod · 0.80
toMethod · 0.80
toAliasMethod · 0.80
configureMethod · 0.65
bindMethod · 0.45

Tested by

no test coverage detected