Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
1
2
3
4
5
6
7
8
9
10
11
import { blob } from "https://esm.town/v/std/blob?v=12";
import { msMinute } from "https://esm.town/v/stevekrouse/msMinute";
export let intervalMonitor = async (req) => {
const intervalMonitorUpdatedAt = await blob.getJSON("intervalMonitorUpdatedAt");
if (Date.now() - intervalMonitorUpdatedAt > 5 * msMinute) {
return new Response(null, { status: 500 });
} else {
return Response.json({ lastIntervalCheck: intervalMonitorUpdatedAt });
}
};
stevekrouse-intervalmonitor.web.val.run
May 2, 2024