Fetching remote data
Gatsby has a rich ecosystem of data source plugins—we don't have time go through all of them. It's common for a Gatsby source plugin to reach out to another system and fetch data over the network at build time. The gatsby-source-hacker-news
plugin is a great plugin to start with, so that you can see how this fetching process works with Gatsby.
Instead of building your own Hacker News website using Gatsby, we'll use the demo created by https://github.com/ajayns. To get started, you can clone into his repo as follows:
git clone https://github.com/ajayns/gatsby-hacker-news.gitcd gatsby-hacker-news
Then you can install dependencies, including the gatsby-source-hacker-news
plugin:
npm install
You don't need to edit the project configuration to enable anything, because this is already a Gatsby project. Simply start the development server as you've done throughout this chapter:
gatsby develop
Compared to other websites you've worked on this chapter, this time around the build takes...