New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gatsby-source-strapi

Package Overview
Dependencies
Maintainers
8
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-source-strapi

Gatsby source plugin for building websites using Strapi as a data source

  • 1.0.0-alpha.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6K
decreased by-13.45%
Maintainers
8
Weekly downloads
 
Created
Source

gatsby-source-strapi

Source plugin for pulling documents into Gatsby from a Strapi API.

WARNING: This is the README for v1.0.0 which is in alpha version for now. Make sure to install it with @alpha to try it out. It's designed to be used with Gatsby v3.

Install

npm install --save gatsby-source-strapi@alpha

How to use

// In your gatsby-config.js
plugins: [
  {
    resolve: `gatsby-source-strapi`,
    options: {
      apiURL: `http://localhost:1337`,
      queryLimit: 1000, // Default to 100
      contentTypes: [
        `article`,
        `user`,
        // if you don't want to leave the definition of an api endpoint to the pluralize module
        {
          name: `collection-name`,
          endpoint: `custom-endpoint`,
        },
      ],
      //If using single types place them in this array.
      singleTypes: [`home-page`, `contact`],
      // Possibility to login with a strapi user, when content types are not publically available (optional).
      loginData: {
        identifier: '',
        password: '',
      },
    },
  },
];

How to query

You can query Document nodes created from your Strapi API like the following:

{
  allStrapiArticle {
    edges {
      node {
        id
        title
        content
      }
    }
  }
}

To query images you can do the following:

{
  allStrapiArticle {
    edges {
      node {
        id
        singleImage {
          localFile {
            publicURL
          }
        }
        multipleImages {
          localFile {
            publicURL
          }
        }
      }
    }
  }
}

Keywords

FAQs

Package last updated on 20 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc