MCPcopy Index your code
hub / github.com/loopbackio/loopback-next / mountComponent

Function mountComponent

packages/core/src/component.ts:112–167  ·  view source on GitHub ↗
(app: Application, component: Component)

Source from the content-addressed store, hash-verified

110 * @param component - Component instance
111 */
112export function mountComponent(app: Application, component: Component) {
113 if (component.classes) {
114 for (const classKey in component.classes) {
115 const binding = createBindingFromClass(component.classes[classKey], {
116 key: classKey,
117 });
118 app.add(binding);
119 }
120 }
121
122 if (component.providers) {
123 for (const providerKey in component.providers) {
124 const binding = createBindingFromClass(component.providers[providerKey], {
125 key: providerKey,
126 });
127 app.add(binding);
128 }
129 }
130
131 if (component.bindings) {
132 for (const binding of component.bindings) {
133 app.add(binding);
134 }
135 }
136
137 if (component.controllers) {
138 for (const controllerCtor of component.controllers) {
139 app.controller(controllerCtor);
140 }
141 }
142
143 if (component.servers) {
144 for (const serverKey in component.servers) {
145 app.server(component.servers[serverKey], serverKey);
146 }
147 }
148
149 if (component.lifeCycleObservers) {
150 for (const observer of component.lifeCycleObservers) {
151 app.lifeCycleObserver(observer);
152 }
153 }
154
155 if (component.services) {
156 for (const service of component.services) {
157 app.service(service);
158 }
159 }
160
161 if (component.components) {
162 for (const c of component.components) {
163 if (c === component) continue;
164 app.component(c);
165 }
166 }
167}

Callers 2

componentMethod · 0.90
component.unit.tsFile · 0.85

Calls 7

createBindingFromClassFunction · 0.90
lifeCycleObserverMethod · 0.80
addMethod · 0.65
componentMethod · 0.65
controllerMethod · 0.45
serverMethod · 0.45
serviceMethod · 0.45

Tested by

no test coverage detected