title: How to make a Cron job for a typescript class method
body: <p>In Typescript, I have a controller class that has a method that I want to run daily at 5am.</p>
  <p>My first thought was to schedule something using node-cron or node-scheduler, but these seem to be strictly for node projects, not typescript.</p>
  <p>What I need to happen is a) transpile my entire typescript project into node and then b) Run the method as scheduled.</p>
  <p>There doesn't seem to be any explanation on how to do this though.  The explanations I do see are all about running a node.js function on some schedule, such as this one:
  <a href="https://stackoverflow.com/questions/20499225/i-need-a-nodejs-scheduler-that-allows-for-tasks-at-different-intervals">I need a Nodejs scheduler that allows for tasks at different intervals</a></p>
  <p>The below code illustrates my best approximation at what I'm trying to do.</p>
  <p>controller.ts</p>
  <pre><code>import SomeOtherClass from './factory';
  
  class MyController {
      public async methodToRun(){
          console.log (&quot;King Chronos&quot;)
      }
  }
  </code></pre>
  <p>cron-job.ts</p>
  <pre><code>import MyController from &quot;../src/controller&quot;;
  
  let controller = new MyController();
  var cronJob = require('cron').CronJob;
  var myJob = new cronJob('00 30 11 * * 1-5', function(){
        controller.methodToRun();
        console.log(&quot;cron ran&quot;)
  });
  myJob.start();
  </code></pre>