This plugin sets up source for Gatsby application fetching data from MyMiniFactory API
To install the plugin, follow these steps.
-
Gatsby loads plugins from the your local website plugins folder which is a folder named
plugins
in the website’s root directory. So place the plugin folder inside it. -
Ensure that npm is installed. This provides dependencies to run the plugin.
-
From the plugin folder, execute the following command:
npm install
Open gatsby-config.js
from the root directory of your project site, and add the gatsby-source-mmf plugin inside plugin table:
plugins: [
...,
{
resolve: "gatsby-source-mmf",
options: {
name: "MyMiniFactoryObject",
url: "https://www.myminifactory.com/api/v2/search",
key: <API-KEY>,
cat: "112",
per_page: "23",
light: "1",
sort: "popularity",
},
},
]
Your plugin is ready. Start gatsby develop
and open a browser at http://localhost:8000/___graphql. The MyMiniFactory data can be queried from here. try:
query MyQuery {
allMyMiniFactoryObject {
edges {
node {
id
url
name
}
}
}
}