Toggling a Worker route programatically/on a schedule

I’ve been considering implementing a Worker that displays a “down for scheduled maintenance” page.

The Worker itself seems trivial to write, but the problem is controlling it - as far as I can tell, you have to manually toggle the route from the site dashboard. I want it to be automatically toggled on when automated maintenance starts (very early morning, my time!) and toggled off when it ends.

Cron triggers don’t support this, and it doesn’t look like Wrangler has any options for it either. Anyone have any pointers, or am I just SOL?

You can use the API to create and delete routes

1 Like

Oh awesome! I totally forgot to look at the general API. Thank you :slight_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.