routes
export const router
index.ts
// Many imports... export const router = createPlaywrightRouter(); router.addDefaultHandler(defaultHandler); router.addHandler('catalog-page', catalogHandler); router.addHandler('review-page', reviewsHandler);
handler: (ctx: Omit<Context, 'request'> & { request: Request<UserData> }) => Awaitable<void>
Context
Router
type Handler = (ctx: Omit<PlaywrightCrawlingContext<Dictionary>, 'request'> & { request: Request<Dictionary>; }) => Awaitable<void> const handleRoute: Handler = async ({ page }) => { console.log(await page.title()); }; const router = createPlaywrightRouter(); router.addHandler('handler', handleRoute);