Node.js
Using fetch (Node 18+)
const PING_URL = "https://watchcron.com/ping/your-uuid"; await fetch(`${PING_URL}/start`); try { await runMyTask(); await fetch(PING_URL); } catch (err) { await fetch(`${PING_URL}/fail`, { method: "POST", body: err.message }); throw err; }
Using https module (no dependencies)
const https = require('https'); function ping(url) { return new Promise((resolve) => { https.get(url, resolve).on('error', resolve); }); } const PING_URL = "https://watchcron.com/ping/your-uuid"; await ping(`${PING_URL}/start`); await runMyTask(); await ping(PING_URL);