Last active
August 20, 2018 17:10
-
-
Save joemccann/626fb65255804e5fc8e50e295aa1fdf2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const tiny = require('tiny-json-http') | |
const schedule = require('node-schedule') | |
const { | |
error, | |
log | |
} = console | |
function main() { | |
schedule.scheduleJob('* * * * *', async () => { | |
const urls = [ | |
`https://XXX.now.sh/`, | |
`https://YYY.now.sh/` | |
] | |
for (let url of urls) { | |
try { | |
const ping = await tiny.get({ | |
url | |
}) | |
log(`Status: ${ping.body.status} | Timestamp: ${ping.body.timestamp}`) | |
} catch (e) { | |
error(e) | |
} | |
} | |
}) | |
} | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment