Ergast API for Gatsby
Simple source plugin to grab the latest Formula 1 season data from the fantastic Ergast API.
🏎 Quick start
yarn add gatsby-source-ergast
npm i gatsby-source-ergast
Add this to your
gatsby-config.js file 👍
plugins: [ "gatsby-source-ergast", ],
🧐 What’s inside?
/gatsby-source-ergast ├── .gitignore ├── gatsby-node.js ├── index.js ├── LICENSE ├── package.json └── README.md
.gitignore: Stuff not to track.
gatsby-node.js: The good stuff 👀.
index.js: A file that will be loaded by default when the plugin is required by another application.
LICENSE: This source plugin is licensed under the 0BSD license.
package.json: A manifest file, which includes things like metadata.
README.md: A text file containing useful reference information.
Feel free to submit updates/PRs for this source plugin. It’s still very basic and could be expanded to include a lot more control over the data pulled from Ergast.
Inline with the request from Ergast to keep calls to a minimum, Gatsby will call the API to reqest data at build-time. The slight downside being that you’ll need to manually build the site (or feel free to make a webhook) after a race meeting, to ensure the results/standings and times are all up to date.
If this is something i end up creating, i’ll update the plugin readme to reflect this.