import CloudflareWorkerGlobalScope , { CloudflareWorkerKV } from 'types-cloudflare-worker' ; import fileCore from "../lib/fileCore" ; declare var self ; declare var STATIC_KV ; export class Worker { public async handle ( event ) { let path = new URL ( event . request . url ) . pathname ; if ( path == '/' ) { path = '/index.html' ; } let _filecore = await fileCore . getFile ( path , STATIC_KV , true , event . request ) ; if ( _filecore ) { return _filecore ; } return new Response ( "404 not found" , { status : 404 } ) ; } } self . addEventListener ( 'fetch' , ( event ) => { const worker = new Worker ( ) ; event . respondWith ( worker . handle ( event ) ) ; } ) ;