Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people's questions, and connect with other people.

Have an account? Sign In

Captcha Click on image to update the captcha.

Have an account? Sign In Now

Sign In

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have a permission to ask a question, You must login to ask question.

Forgot Password?

Need An Account, Sign Up Here
Tech Answered Logo Tech Answered Logo
Sign InSign Up

Tech Answered

Tech Answered Navigation

  • Home
  • Tutorials
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • About Us
  • Blog
  • Contact Us
Home / Questions /Q 300
Next
In Process
shree
shree

shree

  • India
  • 138 Questions
  • 69 Answers
  • 2 Best Answers
  • 200 Points
View Profile
  • 0
shree
Asked: August 5, 20202020-08-05T04:46:02+05:30 2020-08-05T04:46:02+05:30In: Programming Related

How to schedule post request in node.js

  • 0

How we can schedule a post request in node.js,so that the data get printed on website in every 24 hours. Or any given schedule time,the data should be printed.

node jsschedule post request in node js
  • 1
  • 1,862
  • 0
  • 0
Answer
Share
  • Facebook

    Related Questions

    • How to Add, Install SSL Certificate to Your Website
    • What are some key considerations when designing a logo for a company that will be used online and in print?
    • Image Gallery With Animations Using HTML And CSS Code
    • How to backup android phone to pc before factory reset
    • What part does content play in SEO, and what impact does it have on search engine rankings?
    • code for matrix multiplication in c
    • How to add scrolling text in Blogger

    1 Answer

    1. Jubreel
      2020-08-06T12:54:07+05:30Added an answer on August 6, 2020 at 12:54 pm

      You can use node-cron. Firstly you need to run npm i node-cron to install.

      To register a task all you have to do is:

      const cron = require(‘node-cron’);

      const printData = () => { console.log(“Hello dear”) };

      // schedule takes two arguments, cron time and the task to call when we reach that time. I used a random time ad task here so you can change it.

      cron.schedule(’10 20 23 9 1′

      printData())

      You can use the example below to incorporate it in your app:

      const allSubscriptions = {}

      const registerTasks = (subscription) => { const endpoint = subscription.endpoint;

      // Calculate time according to your location, the time below is an example.

      const morningTask = cron.schedule(‘30 23 * * *‘, () => { sendNotification(subscription, JSON.stringify({ timeOfDay: ‘morning‘ })); });

      const afternoonTask = cron.schedule(‘30 6 * * *‘, () => { sendNotification(subscription, JSON.stringify({ timeOfDay: ‘afternoon‘ })); });

      const nightTask = cron.schedule(‘15 14 * * *‘, () => { sendNotification(subscription, JSON.stringify({ timeOfDay: ‘evening‘ })); }); allSubscriptions[endpoint] = [morningTask, afternoonTask, nightTask]; };

      • 2
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    Leave an answer

    Leave an answer
    Cancel reply

    Browse

    Sidebar

    Ask A Question

    More Questions

    • arunraj503

      How to Add, Install SSL Certificate to Your Website

    • EmmaScott

      What are some key considerations when designing a logo for

    • dynamicapps5

      Image Gallery With Animations Using HTML And CSS Code

    • arunraj503

      How to backup android phone to pc before factory reset

    • SEO_BRISK

      What part does content play in SEO, and what impact

    • glenn

      code for matrix multiplication in c

    • sita

      How to add scrolling text in Blogger

    • dynamicapps5

      how to solve error illegal start of expression in java

    Stats

    • Questions 1,989
    • Answers 2,101
    • Posts 12
    • Best Answers 73

    Related Questions

    • arunraj503

      How to Add, Install SSL Certificate to Your Website

    • EmmaScott

      What are some key considerations when designing a logo for a company

    • dynamicapps5

      Image Gallery With Animations Using HTML And CSS Code

    • arunraj503

      How to backup android phone to pc before factory reset

    • SEO_BRISK

      What part does content play in SEO, and what impact does it

    • glenn

      code for matrix multiplication in c

    • sita

      How to add scrolling text in Blogger

    • dynamicapps5

      how to solve error illegal start of expression in java

    Explore

    • Home
    • Communities
    • Questions
      • New Questions
      • Trending Questions
      • Must read Questions
      • Hot Questions
    • Polls
    • Tags
    • Badges
    • Users
    • Help

    Footer

    Recent Comments

    • muller on how to solve export problem in kinemaster
    • muller on how to solve export problem in kinemaster
    • AaronBlackburn on why can’t i find my message requests on instagram
    • shree on How to use philips citrus press juicer 25 watts Demo
    • kiran kumar85 on How To Insert Names Automatically in Excel Sheet With VBA Code
    Ask A Question

    Archives

    Tags

    laptop buying guide (1) limit google news notifications (1) printer buying guide (1) stop google news notifications (1) turn off google news notifications (1)

    Social media

    © 2023 @ Techanswered.com.
    Terms, Privacy policy & Sitemap.

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.