It shouldn't matter where the Response came from, the edge cache middleware should be able to cache it and serve it early in the middleware chain.
// These would be our cache middleware options
type CacheOptions = {
getCacheKey?: (req: URL) => string
cache?: typeof caches.default
edgeTTL?: number
browserTTL?: number
edgeTTLForHTML?: number
browserTTLForHTML?: number
allowedMethods?: Method[]
}
import { Router, cache } from '8track'
const app = new Router()
// Cache all GET requests
app.get`(.*)`.use(cache())
...
It shouldn't matter where the
Response
came from, the edge cache middleware should be able to cache it and serve it early in the middleware chain.