Skip to content

Gatsby source plugin that fetches user articles from Dev.to

License

Notifications You must be signed in to change notification settings

geocine/gatsby-source-dev

Folders and files

NameName
Last commit message
Last commit date

Latest commit

0dbcffa · May 30, 2020

History

17 Commits
Apr 17, 2019
Mar 26, 2019
Mar 26, 2019
Mar 26, 2019
Mar 26, 2019
Mar 26, 2019
Mar 26, 2019
Mar 26, 2019
Mar 26, 2019
May 30, 2020
Jun 2, 2019
Jun 2, 2019

Repository files navigation

header
gatsby-source-dev

NPM version Build Status

A Gatsby plugin that fetches user articles from Dev.to’s /articles?username combined with /articles/${id} endpoint.

Usage

Install gatsby-source-dev in your project:

yarn add gatsby-source-dev
npm install gatsby-source-dev

Then add the plugin to your gatsby-config.js file:

{
  resolve: "gatsby-source-dev",
  options: {
    // This is your username on Dev.to
    username: ''
  }
}

The plugin will store the Dev.to API response in Gatsby. Here's an example of a query that fetches an articles title, id, and description.

{
  allDevArticles {
    edges {
      node {
        article {
          id
          title
          description
        }
      }
    }
  }
}

The node contains the entire response from Dev.to’s endpoint.

Pagination is not yet implemented