Mayank Painkra
Mayank Painkra

Reputation: 33

Getting an error while using node-schedule package

I need to do a assignment and my assignment is to extract fresh WHOIS records database of daily registering domains, which should consist of the name, domain name, email ID, and phone number, and be auto-emailed via cron on a daily basis.

My code is :

import whois from 'whois'
import schedule from 'node-schedule'
import pandas from 'pandas'
import smtp from 'smtp'


const job = schedule.scheduleJob('0 10 * * *', () => {
    const domains = whois.getRegisteredDomains();
  
    const filteredDomains = domains.filter((domain) => {
      return domain.registeredDate >= new Date();
    });
  
    const df = pandas.DataFrame(filteredDomains);
    df.to_csv('domains.csv');
  
    const mailOptions = {
      from: '[email protected]',
      to: '[email protected]',
      subject: 'New Domains',
      text: filteredDomains
    };
    smtp.sendMail(mailOptions);
  });

  console.log(job)
  
  job.start();

and the error im getting is TypeError: job.start is not a function

I tried looking the error online but I didn't find anything related to it.

Upvotes: 1

Views: 25

Answers (0)

Related Questions