From d1f0112710c609fa12f270a3421e24db446444e8 Mon Sep 17 00:00:00 2001 From: Philippe Serhal Date: Wed, 06 May 2026 11:28:24 +0000 Subject: [PATCH] feat: add initial version of spec page --- index.html | 277 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------- public/tangled.svg | 154 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 file(s) changed, 423 insertion(s)(+), 8 deletion(s)(-) diff --git a/index.html b/index.html --- a/index.html +++ b/index.html @@ -1,13 +1,274 @@ - - - - - Fetchable - - + + + + + Fetchable specification + + + + + +

Fetchable

- +

standard interface for request entry points

+
+
+

+ Fetchable is a type interface that request entry point + ES modules may implement to ensure compatiblity with many + platforms, runtimes, frameworks, and other tools. It is designed to be simple, flexible, and + extensible. It is documented here as a reference to encourage adoption and interoperability + across the ecosystem. +

+ +

Definitions

+ +

+ A Fetchable module is an ECMAScript module whose default export is an + object with a fetch property conforming to the + FetchHandler interface (ref). This method is intended to be invoked to handle an incoming HTTP request. +

+ + interface Fetchable { + default: { + fetch(request: Request, ...extra: unknown[]): Promise<Response> | Response + } +} + +

+ The first argument MUST be a + Web Request. The + return value MUST be either a + Web Response + or a promise resolving to a Web Response. +

+ +

+ Invokers may pass additional custom arguments. Fetchable modules may have + additional properties on their default export. +

+ +

Example

+ + // entrypoint.ts +export default { + async fetch(req: Request): Promise<Response> { + return new Response(`Hello, ${req.headers.get("User-Agent")}!`) + } +} + +

Interoperable with...

+ + +
+ + + + + + diff --git a/public/tangled.svg b/public/tangled.svg new file mode 100644 --- /dev/null +++ b/public/tangled.svg @@ -0,0 +1,154 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- tangled.sh