Eleventy and baserow

Cross-posting a thread from Eleventy discussions

Hi to you all! I am just getting started with learning JavaScript, but I am a heavy Eleventy user. Still, I have much more to learn.

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 data folder?

I found very few tutorials about using Baserow API, and knowing very, very little JavaScript I cannot really get my head around it.

Any link to insightful resources or any help would be very much appreciated!

Hi @tommi!

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.

1 Like

It is true that we currently lack in-depth tutorials e.g. about using Baserow from JavaScript so there is a bit for you to figure out. In general you will need:

  • 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!