import { Handler } from "./handler.js"; import { Config } from "./config.js"; import configObj from "../config.worker.example.json"; // must be set at build time const config = new Config(configObj); if (config.cache) { throw new Error("Cache is not supported in worker mode"); } export default { async fetch(request, env, ctx) { const url = new URL(request.url); const host = url.host; const path = url.pathname; const handler = await Handler.fromConfig(config); const { status, content, contentType } = await handler.handleRequest({ host, path, }); return new Response(content, { status, headers: { "Content-Type": contentType }, }); }, };