@crawlee/httpFunctionscreateHttpRouterVersion: 3.1createHttpRouter CallablecreateHttpRouter<Context>(): RouterHandler<Context>Creates new Router instance that works based on request labels. This instance can then serve as a requestHandler of your HttpCrawler. Defaults to the HttpCrawlingContext. Serves as a shortcut for using Router.create<HttpCrawlingContext>().import { HttpCrawler, createHttpRouter } from 'crawlee';const router = createHttpRouter();router.addHandler('label-a', async (ctx) => { ctx.log.info('...');});router.addDefaultHandler(async (ctx) => { ctx.log.info('...');});const crawler = new HttpCrawler({ requestHandler: router,});await crawler.run();Type parametersContext: HttpCrawlingContext<any, any, Context> = HttpCrawlingContext<any, any>Returns RouterHandler<Context>
Creates new Router instance that works based on request labels. This instance can then serve as a
requestHandler
of your HttpCrawler. Defaults to the HttpCrawlingContext.