MCPcopy Create free account
hub / github.com/omkarcloud/botasaurus / addScraperAlias

Method addScraperAlias

js/botasaurus-server-js/src/api-config.ts:940–951  ·  view source on GitHub ↗

* Adds an alias for a specific scraper's direct call route bypassing Task System. * @param {Function} scraper - The scraper function to add an alias for. * @param {string} endpoint - The alias path (e.g., '/hotels/search'). * @example * ApiConfig.addScraperAlias(hotelsSearchScrap

(scraper: Function, endpoint: string)

Source from the content-addressed store, hash-verified

938 * ApiConfig.addScraperAlias(hotelsSearchScraper, '/hotels/search');
939 */
940 static addScraperAlias(scraper: Function, endpoint: string): void {
941 if (!endpoint) return;
942
943 if (!this.routeAliases.has(scraper)) {
944 this.routeAliases.set(scraper, [cleanBasePath(endpoint)]);
945 } else {
946 const aliasArray = this.routeAliases.get(scraper)!;
947 if (!aliasArray.includes(endpoint)) {
948 aliasArray.push(cleanBasePath(endpoint));
949 }
950 }
951 }
952
953 /**
954 * Adds custom routes to the API server using Fastify's routing system.

Callers

nothing calls this directly

Calls 4

cleanBasePathFunction · 0.90
hasMethod · 0.45
getMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected