1.0.0 • Published 4 years ago

gatsby-source-duolingo v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

gatsby-source-duolingo

Source plugin for pulling user language data into Gatsby from Duolingo.

Install

npm install --save gatsby-source-duolingo

or

yarn add gatsby-source-duolingo

How to use

First, you need a way to pass environment variables to the build process, so secrets and other secured data aren't committed to source control. We recommend using dotenv which will then expose environment variables. Read more about dotenv and using environment variables here. Then we can use these environment variables and configure our plugin.

Using Delivery API

// In your gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: `gatsby-source-duolingo`,
      options: {
        username: `your_username`,
        // Learn about environment variables: https://gatsby.dev/env-vars
        identifier: process.env.DUOLINGO_IDENTIFIER,
        password: process.env.DUOLINGO_PASSWORD,
      },
    },
  ],
};

Configuration options

username string

Duolingo username

identifier string

Email account used to sign-in to your Duolingo account

password string

Password used to sign-in to your Duolingo account

Query for all nodes

{
  allDuolingoLanguage {
    edges {
      node {
        id
        language_string
      }
    }
  }
}

Query for a single node

export const query = graphql`
  {
    duolingoLanguage(language: { eq: "zs" }) {
      id
      language_string
    }
  }
`;