*router.post("/add", async (res, req) => { return CustomResponse(myJSONPayload, 200) })itty-router ?[sites] attribute in wrangler.toml then yes, they're charged since that uploads them to Workers KV but there's no size limit that way except for the KV per-value limit.hono was amazing than itty for the routing and cors issuectx.waitUntil is for exactly in context of BetterKV?waitUntil to ensure that it will keep running, even if you have returned a ResponsebKv.put revalidate values stored with the same key?cache.delete or maybe even cache.put does that for you (im testing that right now), but what about KV ?cacheTtl to a year.old.ts in the directoryconst corsHeaders = {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': '*',
'Access-Control-Max-Age': '86400', // optional
'Access-Control-Allow-Headers': 'Content-Type',
};
const CustomResponse = (body: any, status: number = 200) => {
return new Response(body, {
headers: {
...corsHeaders,
'Content-Type': 'application/json',
},
status,
});
};import { Router, createCors, error, json } from 'itty-router'
const { preflight, corsify } = createCors()
const router = Router()
router
// embed preflight upstream to handle all OPTIONS requests
.all('*', preflight)export const router = Router();
const { preflight, corsify } = createCors({
methods: ['GET', 'POST'],
origins: [
// Your origins that are okay here
]
});
router
.all('*', preflight)
.all('*', defaultRoutes.handle)
.all('*', () => error(404));cacheTtlold.ts