Skip to content

Can 11ty be instructed to repeatedly poll external API data while running in serve or watch mode? #1358

@kkgthb

Description

@kkgthb

I'm working on a proof of concept where I host an Eleventy project running in "--start" mode on Heroku (the only general-purpose long-running NodeJS host I have any familiarity with), intended to function as a "live preview" playground for content authors working in Sanity CMS (or any other API-based CMS).

I can see a few blog posts and starters for Contentful, DatoCMS, Sanity CMS, etc. but before I get too deep into the weeds, a question I can't quite find an answer to myself is:

Can you get 11ty to "watch" for external data changes?

I see that a server running 11ty in "--serve" mode will watch for changes to files in its local filesystem, but since a host like Heroku will restart the server every time I use Git to make a change to the files in its filesystem, that's not exactly useful.

That's what took me back to the idea of API-based CMSes.

Gatsby has a gatsby-source-sanity plugin that can be configured to frequently ping Sanity's "drafts" API options such as watchMode and overlayDrafts. To me, this implies that Gatsby SSG itself can be told to frequently poll an external site while running in develop mode.

Is there a way to tell Eleventy to "frequently poll an external site while running in serve or watch mode?" I'm struggling to find documentation or tutorials.

Or is that just something that Eleventy can't do? (Don't want to waste my time to find this out the hard way!)

Thanks so much.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions