edge-master
Version:
A Micro Framework for Edges
20 lines (19 loc) • 529 B
TypeScript
/// <reference types="@cloudflare/workers-types" />
export type IMatcher = (req: Request) => boolean;
export type RequestHandlerArgs<T = any> = {
req: Request;
env?: T;
exeCtx?: ExecutionContext;
};
export type ContextState = Map<string, any>;
export type Context = {
reqCtx: RequestHandlerArgs;
responder: (res: Response | PromiseLike<Response>) => void;
state: ContextState;
};
export type ContextWithReq = Context & {
req: Request;
};
export type ContextWithRes = Context & {
res: Response;
};