title: scheduler fetch data every midnight
body: <p>how to add a scheduler with a specific time so that the application can synchronize data at a specified time</p>
  <pre><code>addCron, _ := time.LoadLocation(&quot;Asia/Jakarta&quot;)
  scheduler := cron.New(cron.WithLocation(addCron))
  
  defer scheduler.Stop()
  
  scheduler.AddFunc(&quot;10 00 * * 1-6&quot;, ExecuteRoutine)
  
  // start scheduler
  go scheduler.Start()
  done := make(chan bool)
  
  // trigger shutdown
  sig := make(chan os.Signal, 1)
  signal.Notify(sig, syscall.SIGINT, syscall.SIGTERM)
  &lt;-sig
  done &lt;- true
  </code></pre>
  <p>function and endpoint that will collect automatically at the midnight</p>
  <pre><code>httpRouter.Post(&quot;/master/upsertIntoServices&quot;, services.UpsertIntoServices)
  </code></pre>
  <p>how to add that endpoint into a function <code>ExecuteRoutine</code>, so it can do a cron job every midnight</p>