Cross-posting a thread from Eleventy discussions
In particular, I was wondering if somebody could help me in figuring out how to automatically fetch data from Baserow when building my Eleventy website. Is there a way I can use data stored remotely instead of relying on files stored in the
Any link to insightful resources or any help would be very much appreciated!
I assume you are not considering anything like “real time” data or updates based on webhooks, but rather you are building a statically generated website and want to fill your data from Baserow.
What I would suggest is to create a script that will fetch Baserow data from the API (Baserow API spec) and saves them in the format you need (e.g. to that data folder) before you build the website with Eleventy. Then every time you want to rebuild the website, you can fetch the data from Baserow.
Fetch API - Web APIs | MDN or a HTTP client library that can make HTTP calls.
- Construct the proper request by combining the correct URL and body (JSON) for a particular endpoint where you fetch the data.
- Include authentication header in the request with a token you get from the Baserow Settings page.
- Know how to transform or save such retrieved data in JSON to a disk.
Feel free to ask a specific question if you have trouble through the steps!
Thanks a lot, @petrs! You provided a lot of information, still, it is of very little help since I think I would accomplish my purpose best if I could have some working examples and then adapt them to my needs.
Could you help me with that?
Thanks a lot