DEV Community

Discussion on: Strapi, another use case: Build your own API from any website with Puppeteer

Collapse
 
hichamelbsi profile image
ELABBASSI Hicham

Hello Dushyant,

Can you see your content type in the Strapi admin page? Can you share your CRON task script please?

Collapse
 
dkp1903 profile image
Dushyant Pathak • Edited

Thanks for the reply, sir.

Yes, I can see the content-type, Jobs, in the admin page.

Here is my CRON script(functions/cron.js)
gist.github.com/dkp1903/d598e143ea...

Thread Thread
 
hichamelbsi profile image
ELABBASSI Hicham • Edited

Your welcome.

Well, it should work. Can you confirm that your Strapi server CRON configuration is set to true in config/environments/development/server.json.

Also, keep in mind that the CRON task in this example will be executed every 24 hours. Did you wait 24 hours to test the case? Maybe you should modify the CRON expression to execute your script every minutes just to test if the script works well.

...
"*/1 * * * *": (date) => {
...

Don't forget to stop the server after the test :D

Thread Thread
 
dkp1903 profile image
Dushyant Pathak

It works, sir. Forgot about the 24 hour thing. Switched it to a minute and it works right as rain.

Thanks a million!