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
12
13
14
15
16
17
18
19
import { email } from "https://esm.town/v/std/email";
export async function basicDownDetector() {
const now = new Date();
const url = "https://agmm.xyz/";
const r = await fetch(url);
console.log("Response", r);
const text = `
- site: ${url}
- time: ${now.toUTCString()}
- status: ${r.status}`;
if (r.status !== 200) {
console.log("Sending email");
await email({ subject: "Website down", text: text });
}
}
February 28, 2024