usageAlert
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
As of Oct 29, 2024, HTTP vals can comfortably run 2k times per minute.
If you want to get alerted if you val is getting close to those limits, you can wrap your HTTP handler in this middleware:
import { usageAlert } from "https://esm.town/v/stevekrouse/usageAlert"
async function sampleHandler(req: Request): Promise<Response> {
return new Response("Hello, World!");
}
export default usageAlert(sampleHandler);
It keeps a sliding window count of requests in memory (which is perfect for this sittuation) and will send you an email using @std/email if you go over 1k req / min.
Migrated from folder: Archive/usageAlert
