url-master
v0.0.2
Published
Check your urls for response 200
Downloads
3
Maintainers
Readme
check-url
check url every few minutes
your-file.js
const nodemailer = require('nodemailer');
const smtpTransport = require('nodemailer-smtp-transport');
const {CheckMaster} = require('url-master');
const checkMaster = new CheckMaster({
period: 5000, // every 5s
urls: ['http://google.com', 'http://github.com'],
onError: urlErr => {
const mailOptions = {
from: '[email protected]',
to: '[email protected]', // eslint-disable-line id-length
subject: 'Aaaaaaaaaight!',
html: urlErr.statuses.map(status => '<p>' + status + '</p>').join('')
};
const transporter = nodemailer.createTransport(smtpTransport({
service: 'gmail',
auth: {
user: '[email protected]',
pass: 'you-password'
}
}));
transporter.sendMail(mailOptions, mailErr => mailErr ?
console.error(mailErr) :
console.log('Email sent to: [email protected]'));
}
});
checkMaster.run();