MCPcopy
hub / github.com/freshframework/fresh / mountApp

Method mountApp

packages/fresh/src/app.ts:357–385  ·  view source on GitHub ↗

* Merge another code App instance into this app at the * specified path.

(path: string, app: App<State>)

Source from the content-addressed store, hash-verified

355 * specified path.
356 */
357 mountApp(path: string, app: App<State>): this {
358 for (let i = 0; i < app.#commands.length; i++) {
359 const cmd = app.#commands[i];
360
361 if (cmd.type !== CommandType.App && cmd.type !== CommandType.NotFound) {
362 // Apply the inner app's basePath if it exists
363 let effectivePattern = cmd.pattern;
364 if (app.config.basePath) {
365 effectivePattern = mergePath(app.config.basePath, cmd.pattern, false);
366 }
367
368 const clone = {
369 ...cmd,
370 pattern: mergePath(path, effectivePattern, true),
371 includeLastSegment: cmd.pattern === "/" || cmd.includeLastSegment,
372 };
373 this.#commands.push(clone);
374 continue;
375 }
376
377 this.#commands.push(cmd);
378 }
379
380 // deno-lint-ignore no-this-alias
381 const self = this;
382 app.#getBuildCache = () => self.#getBuildCache();
383
384 return this;
385 }
386
387 /**
388 * Create handler function for `Deno.serve` or to be used in

Callers 1

app_test.tsxFile · 0.80

Calls 1

mergePathFunction · 0.90

Tested by

no test coverage detected